Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read Blob Field Value terminates on NULL #30

Open
anders0nmat opened this issue Nov 9, 2022 · 0 comments
Open

Read Blob Field Value terminates on NULL #30

anders0nmat opened this issue Nov 9, 2022 · 0 comments

Comments

@anders0nmat
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant