upload: Pass down content-type of realm icon/logo to backend.

This saves having to try to re-derive it from the file extension,
which may be ".original" in some cases.
This commit is contained in:
Alex Vandiver
2024-07-10 20:54:47 +00:00
committed by Tim Abbott
parent b050c644e3
commit ff90e5355f
8 changed files with 36 additions and 23 deletions

View File

@@ -138,7 +138,9 @@ class LocalUploadBackend(ZulipUploadBackend):
return f"/user_avatars/{realm_id}/realm/icon.png?version={version}"
@override
def upload_realm_icon_image(self, icon_file: IO[bytes], user_profile: UserProfile) -> None:
def upload_realm_icon_image(
self, icon_file: IO[bytes], user_profile: UserProfile, content_type: str
) -> None:
upload_path = self.realm_avatar_and_logo_path(user_profile.realm)
image_data = icon_file.read()
write_local_file("avatars", os.path.join(upload_path, "icon.original"), image_data)
@@ -156,7 +158,7 @@ class LocalUploadBackend(ZulipUploadBackend):
@override
def upload_realm_logo_image(
self, logo_file: IO[bytes], user_profile: UserProfile, night: bool
self, logo_file: IO[bytes], user_profile: UserProfile, night: bool, content_type: str
) -> None:
upload_path = self.realm_avatar_and_logo_path(user_profile.realm)
if night: