mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 18:11:09 +00:00
Update preview_images.py
This commit is contained in:
parent
a1189b40b6
commit
2fbbf522ce
1 changed files with 2 additions and 2 deletions
|
@ -322,7 +322,7 @@ def save_and_cleanup(image, instance=None):
|
||||||
try:
|
try:
|
||||||
old_path = instance.preview_image.name
|
old_path = instance.preview_image.name
|
||||||
except ValueError:
|
except ValueError:
|
||||||
old_path = ""
|
old_path = None
|
||||||
|
|
||||||
# Save
|
# Save
|
||||||
image.save(image_buffer, format="jpeg", quality=75)
|
image.save(image_buffer, format="jpeg", quality=75)
|
||||||
|
@ -343,7 +343,7 @@ def save_and_cleanup(image, instance=None):
|
||||||
instance.save()
|
instance.save()
|
||||||
|
|
||||||
# Clean up old file after saving
|
# Clean up old file after saving
|
||||||
if default_storage.exists(old_path):
|
if old_path and default_storage.exists(old_path):
|
||||||
default_storage.delete(old_path)
|
default_storage.delete(old_path)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
|
|
Loading…
Reference in a new issue