pypxlib icon indicating copy to clipboard operation
pypxlib copied to clipboard

Read Blob Field Value terminates on NULL

Open anders0nmat opened this issue 3 years ago • 0 comments

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.

anders0nmat avatar Nov 09 '22 12:11 anders0nmat