From 27d828538897481b02aa75d91a393e9cc110d02b Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Thu, 14 Mar 2024 14:30:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=9D=99=E6=80=81=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=99=BD=E5=90=8D=E5=8D=95,=E6=B7=BB=E5=8A=A0=E9=9D=9E?= =?UTF-8?q?=E7=A9=BA=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/middleware/static_headers_middleware.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/common/middleware/static_headers_middleware.py b/apps/common/middleware/static_headers_middleware.py index 8c1fa622f..8f5606ab8 100644 --- a/apps/common/middleware/static_headers_middleware.py +++ b/apps/common/middleware/static_headers_middleware.py @@ -17,7 +17,7 @@ class StaticHeadersMiddleware(MiddlewareMixin): if request.path.startswith('/ui/chat/'): access_token = request.path.replace('/ui/chat/', '') application_access_token = QuerySet(ApplicationAccessToken).filter(access_token=access_token).first() - if application_access_token.white_active: + if application_access_token is not None and application_access_token.white_active: # 添加自定义的响应头 response['Content-Security-Policy'] = f'frame-ancestors {" ".join(application_access_token.white_list)}' return response