Merge pull request #1476 from foxsky/fix/env-parser-single-char

fix(env): prevent crash on single-character .env values
This commit is contained in:
gavrielc
2026-03-27 17:09:49 +03:00
committed by GitHub

View File

@@ -30,8 +30,9 @@ export function readEnvFile(keys: string[]): Record<string, string> {
if (!wanted.has(key)) continue; if (!wanted.has(key)) continue;
let value = trimmed.slice(eqIdx + 1).trim(); let value = trimmed.slice(eqIdx + 1).trim();
if ( if (
(value.startsWith('"') && value.endsWith('"')) || value.length >= 2 &&
(value.startsWith("'") && value.endsWith("'")) ((value.startsWith('"') && value.endsWith('"')) ||
(value.startsWith("'") && value.endsWith("'")))
) { ) {
value = value.slice(1, -1); value = value.slice(1, -1);
} }