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