-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
🐛 Fix support for nullable form fields #12502
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
Conversation
01e95e3 to
fef3a69
Compare
|
This is a blocker for us to fix https://access.redhat.com/security/cve/cve-2024-47874 |
|
Hi @tiangolo, |
|
@tiangolo, any plans to merge this? |
|
This pull request has a merge conflict that needs to be resolved. |
| isinstance(field.field_info, params.Form) | ||
| and isinstance(value, str) # For type checks | ||
| and value == "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please clarify why you removed the or (is_sequence_field(field) and len(value) == 0) part from this condition?
| # Empty strings in a form can be a representation of None values | ||
| _, error = field.validate(None, {}, loc=()) | ||
| # If None is an accepted value for this field, use that | ||
| if error is None: | ||
| value = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't really like this part.. Can we try getting this information from field annotation?
|
@maxclaey, thank you for your interest and efforts! |
|
As this PR has been waiting for the original user for a while but seems to be inactive, it's now going to be closed. But if there's anyone interested, feel free to create a new PR. |
Fix support for nullable form fields, differentiate between unspecified and specified as None. See related bug ticket #12245