Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

thumbnail: Skip avatars which have already been migrated.

Alex Vandiver1f9925b1e3dd
diff --git a/zerver/migrations/0544_copy_avatar_images.py b/zerver/migrations/0544_copy_avatar_images.py
index 5769a3798b6..a0b8bfcb0f8 100644
--- a/zerver/migrations/0544_copy_avatar_images.py
+++ b/zerver/migrations/0544_copy_avatar_images.py
@@ -67,6 +67,11 @@ def thumbnail_s3_avatars(users: QuerySet[Any]) -> None:
if total_processed % 100 == 0:
print(f"Processing {total_processed}/{len(users)} user avatars")
+ with contextlib.suppress(Exception):
+ # Check if we've already uploaded this one; if so, continue.
+ avatar_bucket.Object(new_base + ".original").load()
+ continue
+
try:
old_data = avatar_bucket.Object(old_base + ".original").get()
metadata = old_data["Metadata"]