fix: preserve Unicode Vertex ADC paths

This commit is contained in:
Gustavo Madeira Santana 2026-04-03 20:44:16 -04:00
parent 66803c6e10
commit fd236e1fc4
1 changed files with 9 additions and 1 deletions

View File

@ -15,6 +15,14 @@ function hasAnthropicVertexMetadataServerAdc(env: NodeJS.ProcessEnv = process.en
return explicitMetadataOptIn === "1" || explicitMetadataOptIn?.toLowerCase() === "true";
}
function normalizeOptionalPathInput(value: unknown): string | undefined {
if (typeof value !== "string") {
return undefined;
}
const trimmed = value.trim();
return trimmed || undefined;
}
function resolveAnthropicVertexDefaultAdcPath(env: NodeJS.ProcessEnv = process.env): string {
return platform() === "win32"
? join(
@ -29,7 +37,7 @@ function resolveAnthropicVertexAdcCredentialsPathCandidate(
env: NodeJS.ProcessEnv = process.env,
): string {
return (
normalizeOptionalSecretInput(env.GOOGLE_APPLICATION_CREDENTIALS) ??
normalizeOptionalPathInput(env.GOOGLE_APPLICATION_CREDENTIALS) ??
resolveAnthropicVertexDefaultAdcPath(env)
);
}