From 781c84b04b184cbb57853fa2d0cc892e45c980f2 Mon Sep 17 00:00:00 2001 From: "Kai (Tam Nhu) Tran" <61256810+kaitranntt@users.noreply.github.com> Date: Sat, 23 May 2026 21:45:02 -0400 Subject: [PATCH] fix: narrow legacy GLMT base URL normalization (#1376) * fix: narrow legacy glmt base url normalization * style: apply prettier formatting --- src/utils/glmt-deprecation.ts | 6 +----- tests/unit/utils/glmt-deprecation.test.ts | 3 +++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/utils/glmt-deprecation.ts b/src/utils/glmt-deprecation.ts index 8235aea8..38a3599f 100644 --- a/src/utils/glmt-deprecation.ts +++ b/src/utils/glmt-deprecation.ts @@ -25,11 +25,7 @@ export function isLegacyGlmtBaseUrl(baseUrl: string | null | undefined): boolean return false; } - return ( - normalized === LEGACY_GLMT_BASE_URL || - normalized.includes('/api/coding/paas/v4') || - normalized.endsWith('/chat/completions') - ); + return normalized === LEGACY_GLMT_BASE_URL || normalized.includes('/api/coding/paas/v4'); } export function normalizeDeprecatedGlmtEnv(env: Record): GlmtNormalizationResult { diff --git a/tests/unit/utils/glmt-deprecation.test.ts b/tests/unit/utils/glmt-deprecation.test.ts index d003a9e7..592b370a 100644 --- a/tests/unit/utils/glmt-deprecation.test.ts +++ b/tests/unit/utils/glmt-deprecation.test.ts @@ -20,6 +20,9 @@ describe('glmt deprecation helpers', () => { expect(isLegacyGlmtBaseUrl('https://api.z.ai/api/coding/paas/v4/chat/completions/')).toBe( true ); + expect(isLegacyGlmtBaseUrl('https://private.example.internal/v1/chat/completions')).toBe( + false + ); expect(isLegacyGlmtBaseUrl('https://api.z.ai/api/anthropic')).toBe(false); });