From fa654fd7a004860dc2a668020055a046e55813a2 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Thu, 9 Dec 2021 20:13:14 +0000 Subject: [PATCH] user export: Ignore realm icon and logo. These are not considered to be "personal" info, even if you upload them, so we don't export them. Generally the only folks who upload these are admins, who can easily get them in other ways. In fact, anybody can get these via the app. --- zerver/lib/export.py | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/zerver/lib/export.py b/zerver/lib/export.py index 09c86e8a69..41bea392f7 100644 --- a/zerver/lib/export.py +++ b/zerver/lib/export.py @@ -1398,11 +1398,13 @@ def export_uploads_and_avatars( output_dir=emoji_output_dir, realm_emojis=realm_emojis, ) - export_realm_icons( - realm, - local_dir=os.path.join(settings.LOCAL_UPLOADS_DIR), - output_dir=realm_icons_output_dir, - ) + + if user is None: + export_realm_icons( + realm, + local_dir=os.path.join(settings.LOCAL_UPLOADS_DIR), + output_dir=realm_icons_output_dir, + ) else: user_ids = {user.id for user in users} @@ -1451,16 +1453,17 @@ def export_uploads_and_avatars( valid_hashes=emoji_paths, ) - export_files_from_s3( - realm, - handle_system_bots=handle_system_bots, - flavor="realm_icon_or_logo", - bucket_name=settings.S3_AVATAR_BUCKET, - object_prefix=f"{realm.id}/realm/", - output_dir=realm_icons_output_dir, - user_ids=user_ids, - valid_hashes=None, - ) + if user is None: + export_files_from_s3( + realm, + handle_system_bots=handle_system_bots, + flavor="realm_icon_or_logo", + bucket_name=settings.S3_AVATAR_BUCKET, + object_prefix=f"{realm.id}/realm/", + output_dir=realm_icons_output_dir, + user_ids=user_ids, + valid_hashes=None, + ) def _get_exported_s3_record(