Skip to content

Conversation

@maxclaey
Copy link

Fix support for nullable form fields, differentiate between unspecified and specified as None. See related bug ticket #12245

@maxclaey maxclaey changed the title Fix support for nullable form fields 🐛 Fix support for nullable form fields Oct 21, 2024
@alejsdev alejsdev added the bug Something isn't working label Oct 22, 2024
@KennyKnecht
Copy link

This is a blocker for us to fix https://access.redhat.com/security/cve/cve-2024-47874
could someone review & merge this?

@PidgeyBE
Copy link

PidgeyBE commented Apr 2, 2025

Hi @tiangolo,
I'm sorry to involve you here directly, but this fix/PR has been created over 5 months ago.
Since it covers basic functionality (support for nullable form fields) and unblocks CVE fixes, I was just wondering if there is a reason this work cannot be merged?

@heckad
Copy link
Contributor

heckad commented Oct 2, 2025

@tiangolo, any plans to merge this?

@github-actions github-actions bot added the conflicts Automatically generated when a PR has a merge conflict label Oct 11, 2025
@github-actions
Copy link
Contributor

This pull request has a merge conflict that needs to be resolved.

Comment on lines +720 to +722
isinstance(field.field_info, params.Form)
and isinstance(value, str) # For type checks
and value == ""
Copy link
Member

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?

Comment on lines +724 to +728
# 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
Copy link
Member

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?

@YuriiMotov
Copy link
Member

@maxclaey, thank you for your interest and efforts!
Could you please resolve the merge conflict?

@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot closed this Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working conflicts Automatically generated when a PR has a merge conflict waiting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants