fix(admin): 反馈图片代理接口按扩展名固定 Content-Type 并禁用嗅探
This commit is contained in:
1 parent
37b743d5d3
commit
e8ad4cc743
3 files changed
+22
-3
No files matched your search
@@ -144,5 +144,7 @@ def general_feedback_image_raw(feedback_id: int, image_id: int):
|
||||
"""代理输出意见反馈截图字节流(inline 展示用)。"""
|
||||
payload = report_service.get_general_feedback_image_payload(feedback_id, image_id)
|
||||
resp = Response(payload['data'], mimetype=payload['mime_type'])
|
||||
# [SECURITY] Content-Type 已按扩展名白名单收敛,仍禁浏览器嗅探,双保险防内联渲染为 HTML
|
||||
resp.headers['X-Content-Type-Options'] = 'nosniff'
|
||||
resp.headers['Content-Disposition'] = f"inline; filename*=UTF-8''{quote(payload['filename'])}"
|
||||
return resp
|
||||
Reference in new issue
Block a user