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.

export_single_user: Fix extra leading tmp/ in tarball.

Tim Abbott7dd543bee5f0
diff --git a/zerver/management/commands/export_single_user.py b/zerver/management/commands/export_single_user.py
index 76d8f13f70b..89fa29b0220 100644
--- a/zerver/management/commands/export_single_user.py
+++ b/zerver/management/commands/export_single_user.py
@@ -39,5 +39,7 @@ class Command(ZulipBaseCommand):
do_export_user(user_profile, output_dir)
print(f"Finished exporting to {output_dir}; tarring")
tarball_path = output_dir.rstrip("/") + ".tar.gz"
- subprocess.check_call(["tar", "--strip-components=1", "-czf", tarball_path, output_dir])
+
+ os.chdir(os.path.dirname(output_dir))
+ subprocess.check_call(["tar", "-czf", tarball_path, os.path.basename(output_dir)])
print(f"Tarball written to {tarball_path}")