mirror of
https://github.com/FAUSheppy/python-flask-picture-factory
synced 2025-12-05 22:51:36 +01:00
fix: send unmodified file if picture can not be loaded
This commit is contained in:
@@ -37,6 +37,8 @@ def generatePicture(pathToOrig, scaleX, scaleY, encoding, crop):
|
||||
image = PIL.Image.open(os.path.join(PICTURE_DIR, pathToOrig))
|
||||
except FileNotFoundError:
|
||||
return (None, False)
|
||||
except PIL.UnidentifiedImageError:
|
||||
return (os.path.join(PICTURE_DIR, pathToOrig), False)
|
||||
|
||||
# ensure sizes are valid #
|
||||
x, y = image.size
|
||||
|
||||
Reference in New Issue
Block a user