Return 404 if we try to reload_metadata on a missing file.

This commit is contained in:
voussoir 2021-12-21 16:55:03 -08:00
parent 8a44c8ec2e
commit 017523bdac
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -5,6 +5,7 @@ import urllib.parse
from voussoirkit import cacheclass from voussoirkit import cacheclass
from voussoirkit import flasktools from voussoirkit import flasktools
from voussoirkit import pathclass
from voussoirkit import stringtools from voussoirkit import stringtools
import etiquette import etiquette
@ -176,7 +177,10 @@ def post_photo_refresh_metadata_core(photo_ids):
for photo in photos: for photo in photos:
photo._uncache() photo._uncache()
photo = common.P_photo(photo.id, response_type='json') photo = common.P_photo(photo.id, response_type='json')
photo.reload_metadata() try:
photo.reload_metadata()
except pathclass.NotFile:
flask.abort(404)
if photo.thumbnail is None: if photo.thumbnail is None:
try: try:
photo.generate_thumbnail() photo.generate_thumbnail()