-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
LargeBinary and nullable fields crashes when base64 encode is set #409
Comments
The workaround isn't working for me, I'm still seeing
Same situation, here's my annotation:
I'm on py3.8, ormar 0.10.19, at the moment. I've also tried
and a bunch of other variations on str/bytes/None. This bug appears to affect |
Pay attention I do not set |
@igormorgado - I'm aware of the difference between |
Somewhat related, I noticed when trying different combos, this gives an error if you try to pass it None:
ormar/ormar/models/newbasemodel.py Lines 885 to 886 in 1f5d993
|
So this is the line that trips in the traceback: ormar/ormar/queryset/queryset.py Line 1119 in 1f5d993
I suspect this is where it is going sideways. I think it isn't doing the correct conversion. I'm going to hacking around a bit and see what I find. ormar/ormar/queryset/queryset.py Lines 1090 to 1101 in 1f5d993
|
In
in other words, it's a Whereas in Line 98 in 1f5d993
The culprit is definitely |
Should be fixed in 0.10.23 - please update and check |
Seems there is some issue with LargeBinary and nullable fields when base64 encode is set.
The code:
The error:
Or am I doing something very wrong?
PS: If base64 representation is set to "False" , it works nicely. Or if I pass a base64 encoded stream (when
base64
is set toTrue
) aspict_a = await Picture.objects.create(name='A picture', file=base64.b64encode(b'afakepict'))
Also works.
Ugly workaround
An ugly workaround is set the field with a default encoded base64 empty stream as
Originally posted by @igormorgado in #406
The text was updated successfully, but these errors were encountered: