Skip to content
代码片段 群组 项目
提交 92bae77b 编辑于 作者: ctwrs's avatar ctwrs
浏览文件

Add .jpg to allowed thumb formats

上级 226d840e
No related branches found
No related tags found
无相关合并请求
...@@ -29,8 +29,9 @@ def add_pages_to_demo(app): ...@@ -29,8 +29,9 @@ def add_pages_to_demo(app):
if not any([Path(x).resolve() in Path(filename).resolve().parents for x in allowed_dirs]): if not any([Path(x).resolve() in Path(filename).resolve().parents for x in allowed_dirs]):
raise ValueError(f"File cannot be fetched: {filename}. Must be in one of directories registered by extra pages.") raise ValueError(f"File cannot be fetched: {filename}. Must be in one of directories registered by extra pages.")
if os.path.splitext(filename)[1].lower() != ".png": ext = os.path.splitext(filename)[1].lower()
raise ValueError(f"File cannot be fetched: {filename}. Only png.") if ext not in (".png", ".jpg"):
raise ValueError(f"File cannot be fetched: {filename}. Only png and jpg.")
# would profit from returning 304 # would profit from returning 304
return FileResponse(filename, headers={"Accept-Ranges": "bytes"}) return FileResponse(filename, headers={"Accept-Ranges": "bytes"})
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册