Skip to content

Commit

Permalink
Ignore empty string values when parsing metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
di committed Mar 19, 2024
1 parent bf1f041 commit 101c6a5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions warehouse/forklift/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ def parse_form_metadata(data: MultiDict) -> Metadata:
# would just silently ignore it rather than doing something about it.
value = data.getall(name) or []

# An empty string is invalid for all fields, treat it as if it wasn't
# provided in the first place
if value == [""]:
continue

# If this is one of our string fields, then we'll check to see if our
# value is a list of a single item. If it is then we'll assume that
# it was emitted as a single string, and unwrap the str from inside
Expand Down

0 comments on commit 101c6a5

Please sign in to comment.