fix: 平台传来的用户名按 URL 编码解码,中文用户名不再显示成乱码

This commit is contained in:
2026-11-03 14:36:51 +08:00
parent eee7196cb8
commit 98a3ad5ef2
2 changed files with 11 additions and 4 deletions
+2
View File
@@ -116,6 +116,8 @@ def test_identity_needs_matching_proxy_token(monkeypatch):
assert platform_identity({**headers, "x-metrix-user-id": ""}) is None
no_display = platform_identity({**headers, "x-metrix-display-name": ""})
assert no_display is not None and no_display.name == "zhang"
chinese_username = platform_identity({**headers, "x-metrix-username": quote("李四", encoding="utf-8"), "x-metrix-display-name": ""})
assert chinese_username is not None and chinese_username.name == "李四"
def test_base_href_only_accepts_app_prefix():