mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-22 09:31:08 +00:00
export avatars to own directory
Saving avatars to /images is problematic because it changes the original filepath from avatars/filename to images/avatars/filename. In this PR prior to this commit, imports failed as they are looking for a file path beginning with "avatar"
This commit is contained in:
parent
5d597f1ca9
commit
501fb45528
1 changed files with 3 additions and 5 deletions
|
@ -139,9 +139,7 @@ def create_archive_task(job_id):
|
||||||
images_storage = storage_backends.ImagesStorage()
|
images_storage = storage_backends.ImagesStorage()
|
||||||
|
|
||||||
if user.avatar:
|
if user.avatar:
|
||||||
add_file_to_s3_tar(
|
add_file_to_s3_tar(s3_tar, images_storage, user.avatar)
|
||||||
s3_tar, images_storage, user.avatar, directory="images"
|
|
||||||
)
|
|
||||||
|
|
||||||
for edition in editions:
|
for edition in editions:
|
||||||
if edition.cover:
|
if edition.cover:
|
||||||
|
@ -166,7 +164,7 @@ def create_archive_task(job_id):
|
||||||
|
|
||||||
# Add avatar image if present
|
# Add avatar image if present
|
||||||
if user.avatar:
|
if user.avatar:
|
||||||
tar.add_image(user.avatar, directory="images")
|
tar.add_image(user.avatar)
|
||||||
|
|
||||||
for edition in editions:
|
for edition in editions:
|
||||||
if edition.cover:
|
if edition.cover:
|
||||||
|
@ -196,7 +194,7 @@ def export_user(user: User):
|
||||||
"""export user data"""
|
"""export user data"""
|
||||||
data = user.to_activity()
|
data = user.to_activity()
|
||||||
if user.avatar:
|
if user.avatar:
|
||||||
data["icon"]["url"] = archive_file_location(user.avatar, directory="images")
|
data["icon"]["url"] = archive_file_location(user.avatar)
|
||||||
else:
|
else:
|
||||||
data["icon"] = {}
|
data["icon"] = {}
|
||||||
return data
|
return data
|
||||||
|
|
Loading…
Reference in a new issue