mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
rocketchat: File upload chunks may exist without their metadata.
This is likely an error somewhere in rocketchat's MongoDB "eventual consistency," but there is no problem with skipping the chunks at this step. In the one case where this was observed so far, the upload-id was not referenced in any message -- if it is referenced and has chunks, but has no metadata, we will fail later, at that reference.
This commit is contained in:
committed by
Tim Abbott
parent
55e644d70f
commit
28a29e64a0
@@ -765,6 +765,13 @@ def map_upload_id_to_upload_data(
|
||||
upload_id_to_upload_data_map[upload["_id"]] = {**upload, "chunk": []}
|
||||
|
||||
for chunk in upload_data["chunk"]:
|
||||
if chunk["files_id"] not in upload_id_to_upload_data_map: # nocoverage
|
||||
logging.info("Skipping chunk %s without metadata", chunk["files_id"])
|
||||
# It's unclear why this apparent data corruption in the
|
||||
# Rocket.Chat database is possible, but empirically, some
|
||||
# chunks don't have any associated metadata.
|
||||
continue
|
||||
|
||||
upload_id_to_upload_data_map[chunk["files_id"]]["chunk"].append(chunk["data"])
|
||||
|
||||
return upload_id_to_upload_data_map
|
||||
|
||||
Reference in New Issue
Block a user