slack: Store the content-type of realm icons.

This commit is contained in:
Alex Vandiver
2024-07-11 00:55:40 +00:00
committed by Tim Abbott
parent ff90e5355f
commit 5ae34dc42b
2 changed files with 3 additions and 0 deletions

View File

@@ -1339,6 +1339,7 @@ def fetch_team_icons(
"realm_id": realm_id, "realm_id": realm_id,
"path": os.path.join(str(realm_id), "icon.original"), "path": os.path.join(str(realm_id), "icon.original"),
"s3_path": os.path.join(str(realm_id), "icon.original"), "s3_path": os.path.join(str(realm_id), "icon.original"),
"content_type": response.headers["Content-Type"],
} }
) )
@@ -1352,6 +1353,7 @@ def fetch_team_icons(
"realm_id": realm_id, "realm_id": realm_id,
"path": os.path.join(str(realm_id), "icon.png"), "path": os.path.join(str(realm_id), "icon.png"),
"s3_path": os.path.join(str(realm_id), "icon.png"), "s3_path": os.path.join(str(realm_id), "icon.png"),
"content_type": "image/png",
} }
) )

View File

@@ -1317,6 +1317,7 @@ class SlackImporter(ZulipTestCase):
team_info_fixture["team"], team_info_fixture["team"],
] ]
mock_requests_get.return_value.raw = BytesIO(read_test_image_file("img.png")) mock_requests_get.return_value.raw = BytesIO(read_test_image_file("img.png"))
mock_requests_get.return_value.headers = {"Content-Type": "image/png"}
with self.assertLogs(level="INFO"), self.settings(EXTERNAL_HOST="zulip.example.com"): with self.assertLogs(level="INFO"), self.settings(EXTERNAL_HOST="zulip.example.com"):
# We need to mock EXTERNAL_HOST to be a valid domain because Slack's importer # We need to mock EXTERNAL_HOST to be a valid domain because Slack's importer