mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 00:26:33 +00:00
Prevent empty file name
This commit is contained in:
parent
d74df047c5
commit
f26a41bd10
1 changed files with 3 additions and 0 deletions
|
@ -323,6 +323,9 @@ def save_and_cleanup(image, instance=None):
|
|||
try:
|
||||
file_name = instance.preview_image.name
|
||||
except ValueError:
|
||||
file_name = None
|
||||
|
||||
if not file_name or file_name == '':
|
||||
uuid = uuid4()
|
||||
file_name = f"{instance.id}-{uuid}.jpg"
|
||||
|
||||
|
|
Loading…
Reference in a new issue