mirror of https://github.com/zulip/zulip.git
export: Fix path logic for exporting avatars with S3 backend.
Apparently, we missed this when we converted the export format to use longer path names for avatars.
This commit is contained in:
parent
20aa3233b0
commit
4e70c9402a
|
@ -916,17 +916,16 @@ def export_files_from_s3(realm: Realm, bucket_name: str, output_dir: Path,
|
||||||
record['user_profile_email'] = user_profile.email
|
record['user_profile_email'] = user_profile.email
|
||||||
|
|
||||||
if processing_avatars:
|
if processing_avatars:
|
||||||
dirname = output_dir
|
filename = os.path.join(output_dir, key.name)
|
||||||
filename = os.path.join(dirname, key.name)
|
|
||||||
record['path'] = key.name
|
record['path'] = key.name
|
||||||
else:
|
else:
|
||||||
fields = key.name.split('/')
|
fields = key.name.split('/')
|
||||||
if len(fields) != 3:
|
if len(fields) != 3:
|
||||||
raise AssertionError("Suspicious key with invalid format %s" % (key.name))
|
raise AssertionError("Suspicious key with invalid format %s" % (key.name))
|
||||||
dirname = os.path.join(output_dir, fields[1])
|
filename = os.path.join(output_dir, fields[1], fields[2])
|
||||||
filename = os.path.join(dirname, fields[2])
|
|
||||||
record['path'] = os.path.join(fields[1], fields[2])
|
record['path'] = os.path.join(fields[1], fields[2])
|
||||||
|
|
||||||
|
dirname = os.path.dirname(filename)
|
||||||
if not os.path.exists(dirname):
|
if not os.path.exists(dirname):
|
||||||
os.makedirs(dirname)
|
os.makedirs(dirname)
|
||||||
key.get_contents_to_filename(filename)
|
key.get_contents_to_filename(filename)
|
||||||
|
|
Loading…
Reference in New Issue