From 501fb4552890c7336f45392047bb879c519b91c4 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Sat, 13 Apr 2024 12:03:35 +1000 Subject: [PATCH] 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" --- bookwyrm/models/bookwyrm_export_job.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/bookwyrm/models/bookwyrm_export_job.py b/bookwyrm/models/bookwyrm_export_job.py index 09f064ea2..da79de6a8 100644 --- a/bookwyrm/models/bookwyrm_export_job.py +++ b/bookwyrm/models/bookwyrm_export_job.py @@ -139,9 +139,7 @@ def create_archive_task(job_id): images_storage = storage_backends.ImagesStorage() if user.avatar: - add_file_to_s3_tar( - s3_tar, images_storage, user.avatar, directory="images" - ) + add_file_to_s3_tar(s3_tar, images_storage, user.avatar) for edition in editions: if edition.cover: @@ -166,7 +164,7 @@ def create_archive_task(job_id): # Add avatar image if present if user.avatar: - tar.add_image(user.avatar, directory="images") + tar.add_image(user.avatar) for edition in editions: if edition.cover: @@ -196,7 +194,7 @@ def export_user(user: User): """export user data""" data = user.to_activity() if user.avatar: - data["icon"]["url"] = archive_file_location(user.avatar, directory="images") + data["icon"]["url"] = archive_file_location(user.avatar) else: data["icon"] = {} return data