Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions apps/common/middleware/chat_headers_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ def process_response(self, request, response):

if request.path.startswith(CONFIG.get_chat_path()) and not request.path.startswith(
CONFIG.get_chat_path() + '/api'):
access_token = request.path.replace(CONFIG.get_chat_path() + '/', '')
if access_token.__contains__('/') or access_token == 'undefined':
# 路由会把 URL 规范成带结尾斜杠的形式,去掉末尾 '/' 后再校验,
# 否则刷新页面时 access_token 会带 '/',标题替换会被跳过、退回默认 MaxKB
access_token = request.path.replace(CONFIG.get_chat_path() + '/', '').rstrip('/')
if access_token == '' or access_token == 'undefined' or '/' in access_token:
return response
application_access_token = get_application_access_token(access_token, True)
if application_access_token is not None:
Expand Down
Loading