upload: Don't access emoji_file.name attribute upload_emoji_image.

The S3 backend implementation of upload_emoji_image was accessing
emoji_file.name - which is redundant because emoji_file_name already
gets passed in and can be used, and an object of type IO[bytes] may not
have the .name attribute. Spotted by @Fingel.
This commit is contained in:
Mateusz Mandera
2022-01-13 19:18:06 +01:00
committed by Tim Abbott
parent e3080f2db4
commit fe61243cfe

View File

@@ -684,7 +684,7 @@ class S3UploadBackend(ZulipUploadBackend):
def upload_emoji_image(
self, emoji_file: IO[bytes], emoji_file_name: str, user_profile: UserProfile
) -> bool:
content_type = guess_type(emoji_file.name)[0]
content_type = guess_type(emoji_file_name)[0]
emoji_path = RealmEmoji.PATH_ID_TEMPLATE.format(
realm_id=user_profile.realm_id,
emoji_file_name=emoji_file_name,