Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
export: Sort records.json files by path.
Steve Howellc76ca2d0dff3
diff --git a/zerver/lib/export.py b/zerver/lib/export.pyindex bb5865d9ec0..3608941d833 100644--- a/zerver/lib/export.py+++ b/zerver/lib/export.py@@ -359,6 +359,16 @@ def write_data_to_file(output_file: Path, data: Any) -> None:def write_records_json_file(output_dir: str, records: List[Dict[str, Any]]) -> None:+ # We want a somewhat determistic sorting order here. All of our+ # versions of records.json include a "path" field in each element,+ # even though there's some variation among avatars/emoji/realm_icons/uploads+ # in other fields that get written.+ #+ # The sorting order of paths isn't entirely sensical to humans,+ # because they include ids and even some random numbers,+ # but if you export the same realm twice, you should get identical results.+ records.sort(key=lambda record: record["path"])+output_file = os.path.join(output_dir, "records.json")with open(output_file, "wb") as f:# For legacy reasons we allow datetime objects here, unlike