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: Mark content-type of imported attachments.

Alex Vandiver9b4b53ef299c
diff --git a/zerver/data_import/import_util.py b/zerver/data_import/import_util.py
index 3a37fce01e1..e4f18b5a78e 100644
--- a/zerver/data_import/import_util.py
+++ b/zerver/data_import/import_util.py
@@ -543,6 +543,7 @@ def build_attachment(
is_realm_public=True,
path_id=s3_path,
file_name=fileinfo["name"],
+ content_type=fileinfo.get("mimetype"),
)
attachment_dict = model_to_dict(attachment, exclude=["owner", "messages", "realm"])
diff --git a/zerver/tests/test_slack_importer.py b/zerver/tests/test_slack_importer.py
index 3ac4b3d0aef..3d7504bf6be 100644
--- a/zerver/tests/test_slack_importer.py
+++ b/zerver/tests/test_slack_importer.py
@@ -1322,6 +1322,7 @@ class SlackImporter(ZulipTestCase):
self.assertEqual(attachment[0]["file_name"], "apple.png")
self.assertEqual(attachment[0]["is_realm_public"], True)
self.assertEqual(attachment[0]["is_web_public"], False)
+ self.assertEqual(attachment[0]["content_type"], "image/png")
self.assertEqual(zerver_message[9]["has_image"], True)
self.assertEqual(zerver_message[9]["has_attachment"], True)