mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 19:46:46 +00:00
Catch error if notes directory does not exist (#4638)
This commit is contained in:
parent
1b8ad70fb6
commit
eafd2ac966
@ -118,7 +118,11 @@ def delete_old_notes_images():
|
|||||||
# Finally, remove any images in the notes dir which are not linked to a note
|
# Finally, remove any images in the notes dir which are not linked to a note
|
||||||
notes_dir = os.path.join(settings.MEDIA_ROOT, 'notes')
|
notes_dir = os.path.join(settings.MEDIA_ROOT, 'notes')
|
||||||
|
|
||||||
|
try:
|
||||||
images = os.listdir(notes_dir)
|
images = os.listdir(notes_dir)
|
||||||
|
except FileNotFoundError:
|
||||||
|
# Thrown if the directory does not exist
|
||||||
|
images = []
|
||||||
|
|
||||||
all_notes = NotesImage.objects.all()
|
all_notes = NotesImage.objects.all()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user