mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 20:11:14 +00:00
Update preview_images.py
This commit is contained in:
parent
37508d2583
commit
40264e372d
1 changed files with 1 additions and 1 deletions
|
@ -316,13 +316,13 @@ def save_and_cleanup(image, instance=None):
|
||||||
"""Save and close the file"""
|
"""Save and close the file"""
|
||||||
if not isinstance(instance, (models.Book, models.User, models.SiteSettings)):
|
if not isinstance(instance, (models.Book, models.User, models.SiteSettings)):
|
||||||
return False
|
return False
|
||||||
uuid = uuid4()
|
|
||||||
image_buffer = BytesIO()
|
image_buffer = BytesIO()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
file_name = instance.preview_image.name
|
file_name = instance.preview_image.name
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
uuid = uuid4()
|
||||||
file_name = f"{instance.id}-{uuid}.jpg"
|
file_name = f"{instance.id}-{uuid}.jpg"
|
||||||
|
|
||||||
# Save
|
# Save
|
||||||
|
|
Loading…
Reference in a new issue