From 101c6a513e41b4f937360c86b44cbe064922bc4f Mon Sep 17 00:00:00 2001 From: Dustin Ingram Date: Tue, 19 Mar 2024 15:47:45 +0000 Subject: [PATCH] Ignore empty string values when parsing metadata --- warehouse/forklift/metadata.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/warehouse/forklift/metadata.py b/warehouse/forklift/metadata.py index 9eb73207ebb0..309fd33c5a23 100644 --- a/warehouse/forklift/metadata.py +++ b/warehouse/forklift/metadata.py @@ -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