From 78ba313262ef94d92307408a5414251da128b858 Mon Sep 17 00:00:00 2001 From: zhaoying Date: Thu, 16 Apr 2026 10:10:30 +0800 Subject: [PATCH] feat(web): Keep the last 4 characters of the API key as original --- web/src/utils/apiKeyReplacer.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/src/utils/apiKeyReplacer.ts b/web/src/utils/apiKeyReplacer.ts index 561f146d..cc455fc3 100644 --- a/web/src/utils/apiKeyReplacer.ts +++ b/web/src/utils/apiKeyReplacer.ts @@ -43,7 +43,8 @@ export const maskApiKeys = (text: string): string => { result = result.replace(API_KEY_PATTERNS[key as keyof typeof API_KEY_PREFIX], (match) => { const prefixLength = API_KEY_PREFIX[key].length const prefix = match.substring(0, prefixLength) - return prefix + '*'.repeat(match.length - prefixLength) + const suffix = match.slice(-4) + return prefix + '*'.repeat(match.length - prefixLength - 4) + suffix }) })