From e6e3b1212478af42aa1f99b5f366b90f10ef08ed Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 27 Sep 2024 15:35:46 -0700 Subject: [PATCH] import_realm: Fix crash importing data with topic moves. --- zerver/lib/import_realm.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zerver/lib/import_realm.py b/zerver/lib/import_realm.py index 7eb3cecaa6..9d18801a6a 100644 --- a/zerver/lib/import_realm.py +++ b/zerver/lib/import_realm.py @@ -346,6 +346,11 @@ def fix_message_rendered_content( This function sets the rendered_content of the messages we're importing. """ for message in messages: + if content_key not in message: + # Message-edit entries include topic moves, which don't + # have any content changes to process. + continue + if message[rendered_content_key] is not None: # For Zulip->Zulip imports, we use the original rendered # Markdown; this avoids issues where e.g. a mention can no