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.

rocketchat: Fix "OSError: [Errno 36] File name too long" error.

Prakhar Pratyush19d56f77b56a
diff --git a/zerver/data_import/rocketchat.py b/zerver/data_import/rocketchat.py
index 9ab66cfd654..76488664890 100644
--- a/zerver/data_import/rocketchat.py
+++ b/zerver/data_import/rocketchat.py
@@ -402,7 +402,7 @@ def process_message_attachment(
logging.info("Replacing invalid attachment name with random uuid: %s", file_name)
sanitized_name = uuid.uuid4().hex
- if len(sanitized_name) >= 255: # nocoverage
+ if len(sanitized_name.encode("utf-8")) >= 255: # nocoverage
logging.info("Replacing too long attachment name with random uuid: %s", file_name)
sanitized_name = uuid.uuid4().hex