Skip to content

Read Blob Field Value terminates on NULL #30

@anders0nmat

Description

@anders0nmat

When reading Blob fields, it only reads up to the first NULL character. I am not sure whether this is intended behavior

However, changing data to raw in the _deserialize() Method of BytesField fixes the issue.

class BytesField(Field):
	def _deserialize(self, pxval_value):
		return pxval_value.str.val.data[:pxval_value.str.len]
		# Replace with: 
		# return pxval_value.str.val.raw[:pxval_value.str.len]
	def _serialize_to(self, value, pxval_value):
		pxval_value.str.val = value
		pxval_value.str.len = len(value)

Be careful when printing the Blobs though. Took me quite some time to print 40k Bytes of binary String...

I would do a Pull Request but cant currently do that.

I hope this info helps someone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions