Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

slack: Store the content-type of realm icons.

Alex Vandiver5ae34dc42be0
diff --git a/zerver/data_import/slack.py b/zerver/data_import/slack.py
index 5d5d95fb2c3..ddc123d8b09 100644
--- a/zerver/data_import/slack.py
+++ b/zerver/data_import/slack.py
@@ -1339,6 +1339,7 @@ def fetch_team_icons(
"realm_id": realm_id,
"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,
"path": os.path.join(str(realm_id), "icon.png"),
"s3_path": os.path.join(str(realm_id), "icon.png"),
+ "content_type": "image/png",
}
)
diff --git a/zerver/tests/test_slack_importer.py b/zerver/tests/test_slack_importer.py
index 9712ec8d3f3..63c93437753 100644
--- a/zerver/tests/test_slack_importer.py
+++ b/zerver/tests/test_slack_importer.py
@@ -1317,6 +1317,7 @@ class SlackImporter(ZulipTestCase):
team_info_fixture["team"],
]
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"):
# We need to mock EXTERNAL_HOST to be a valid domain because Slack's importer