Skip to content

Commit 448096a

Browse files
Handle rare event of file uploads having data without id (#4581)
Fixes sentry issue keyerror id
1 parent 13c0c73 commit 448096a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

hypha/apply/funds/models/mixins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def process_file_data(self, data, latest_existing_data=None):
110110
new_file_upload = False
111111
for file_data in uploads_data:
112112
# id can be a path or a uuid, where path can exist only for existing files so uuid means a new file
113-
if self._is_valid_uuid(file_data["id"]):
113+
if self._is_valid_uuid(file_data.get("id", None)):
114114
new_file_upload = True # if any new file is uploaded we have to process and save the files
115115

116116
# get existing files from instance
@@ -153,7 +153,7 @@ def _is_valid_uuid(self, value):
153153
try:
154154
uuid.UUID(value)
155155
return True
156-
except ValueError:
156+
except (ValueError, TypeError):
157157
return False
158158

159159
def extract_files(self):

0 commit comments

Comments
 (0)