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.

mattermost: Record relative path, not absolute, for emoji uploads.

Mateusz Mandera06976e5b6aa1
diff --git a/zerver/data_import/mattermost.py b/zerver/data_import/mattermost.py
index 86204e9377e..c655e2657b6 100644
--- a/zerver/data_import/mattermost.py
+++ b/zerver/data_import/mattermost.py
@@ -910,8 +910,8 @@ def write_emoticon_data(
shutil.copyfile(source_path, target_path)
return dict(
- path=target_path,
- s3_path=target_path,
+ path=target_sub_path,
+ s3_path=target_sub_path,
file_name=target_fn,
realm_id=realm_id,
name=data["name"],
diff --git a/zerver/tests/test_mattermost_importer.py b/zerver/tests/test_mattermost_importer.py
index 051edaf6ad1..4c17646e8c7 100644
--- a/zerver/tests/test_mattermost_importer.py
+++ b/zerver/tests/test_mattermost_importer.py
@@ -877,14 +877,19 @@ class MatterMostImporter(MattermostImportTestBase):
exported_emoji_path = self.fixture_file_name(
mattermost_data["emoji"][0]["image"], "mattermost_fixtures"
)
- self.assertTrue(filecmp.cmp(records_json[0]["path"], exported_emoji_path))
+ emoji_dir = os.path.join(output_dir, "emoji")
+ self.assertTrue(
+ filecmp.cmp(os.path.join(emoji_dir, records_json[0]["path"]), exported_emoji_path)
+ )
self.assertEqual(records_json[1]["file_name"], "tick")
self.assertEqual(records_json[1]["realm_id"], 3)
exported_emoji_path = self.fixture_file_name(
mattermost_data["emoji"][1]["image"], "mattermost_fixtures"
)
- self.assertTrue(filecmp.cmp(records_json[1]["path"], exported_emoji_path))
+ self.assertTrue(
+ filecmp.cmp(os.path.join(emoji_dir, records_json[1]["path"]), exported_emoji_path)
+ )
def test_process_message_attachments(self) -> None:
mattermost_data_dir = self.fixture_file_name("", "mattermost_fixtures/direct_channel")