Allow JPEG image files

JPEG is allowed and searched for when looking for previews/thumbs, and therefore should be allowed to view.
This commit is contained in:
Midcoastal
2023-08-15 23:10:30 -04:00
parent 873e864640
commit c9bdd0344d
+1 -1
View File
@@ -34,7 +34,7 @@ def fetch_file(filename: str = ""):
return FileResponse(filename, headers={"Accept-Ranges": "bytes"})
if not any(Path(x).absolute() in Path(filename).absolute().parents for x in allowed_dirs):
return JSONResponse({"error": f"File cannot be fetched: {filename}. Must be in one of directories registered by extra pages."})
if os.path.splitext(filename)[1].lower() not in (".png", ".jpg", ".webp"):
if os.path.splitext(filename)[1].lower() not in (".png", ".jpg", ".jpeg", ".webp"):
return JSONResponse({"error": f"File cannot be fetched: {filename}. Only png and jpg and webp."})
return FileResponse(filename, headers={"Accept-Ranges": "bytes"})