import: Fix importing slack avatars into S3_UPLOAD_BACKEND.

Apparently, a subtle mismatch between the filename/URL formats for our
upload codebases meant that importing Slack avatars into systems using
S3_UPLOAD_BACKEND would end up with the avatars having the wrong URLs.
This commit is contained in:
Tim Abbott 2019-07-21 21:24:39 -07:00
parent bf14a0af4d
commit 02d55928ea
1 changed files with 6 additions and 1 deletions

View File

@ -616,7 +616,12 @@ def import_uploads(import_dir: Path, processes: int, processing_avatars: bool=Fa
if record['s3_path'].endswith('.original'): if record['s3_path'].endswith('.original'):
relative_path += '.original' relative_path += '.original'
else: else:
relative_path += '.png' # TODO: This really should be unconditional. However,
# until we fix the S3 upload backend to use the .png
# path suffix for its normal avatar URLs, we need to
# only do this for the LOCAL_UPLOADS_DIR backend.
if not s3_uploads:
relative_path += '.png'
elif processing_emojis: elif processing_emojis:
# For emojis we follow the function 'upload_emoji_image' # For emojis we follow the function 'upload_emoji_image'
relative_path = RealmEmoji.PATH_ID_TEMPLATE.format( relative_path = RealmEmoji.PATH_ID_TEMPLATE.format(