diff --git a/zerver/management/commands/export.py b/zerver/management/commands/export.py index f2606725ff..2e953b7aa1 100644 --- a/zerver/management/commands/export.py +++ b/zerver/management/commands/export.py @@ -107,7 +107,7 @@ class Command(ZulipBaseCommand): if output_dir is None: output_dir = tempfile.mkdtemp(prefix="/tmp/zulip-export-") else: - output_dir = os.path.realpath(output_dir) + output_dir = os.path.realpath(os.path.expanduser(output_dir)) if os.path.exists(output_dir): shutil.rmtree(output_dir) os.makedirs(output_dir) diff --git a/zerver/management/commands/import.py b/zerver/management/commands/import.py index 8678a9e90f..c84f6fc9d4 100644 --- a/zerver/management/commands/import.py +++ b/zerver/management/commands/import.py @@ -55,15 +55,18 @@ import a database dump from one or more JSON files.""" check_subdomain_available(subdomain, from_management_command=True) + paths = [] for path in options['export_paths']: + path = os.path.realpath(os.path.expanduser(path)) if not os.path.exists(path): print("Directory not found: '%s'" % (path,)) exit(1) if not os.path.isdir(path): print("Export file should be folder; if it's a tarball, please unpack it first.") exit(1) + paths.append(path) - for path in options['export_paths']: + for path in paths: print("Processing dump: %s ..." % (path,)) realm = do_import_realm(path, subdomain) print("Checking the system bots.")