2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-14 19:15:41 +00:00

Catch error if notes directory does not exist (#4638)

This commit is contained in:
Oliver
2023-04-19 22:41:19 +10:00
committed by GitHub
parent 1b8ad70fb6
commit eafd2ac966

View File

@ -118,7 +118,11 @@ def delete_old_notes_images():
# Finally, remove any images in the notes dir which are not linked to a note
notes_dir = os.path.join(settings.MEDIA_ROOT, 'notes')
images = os.listdir(notes_dir)
try:
images = os.listdir(notes_dir)
except FileNotFoundError:
# Thrown if the directory does not exist
images = []
all_notes = NotesImage.objects.all()