Skip to content

Commit

Permalink
fix: variable value beginning with pipe should not be interpreted as …
Browse files Browse the repository at this point in the history
…file (#1457)
  • Loading branch information
ANGkeith authored Dec 13, 2024
1 parent 770c8c3 commit 8ec9299
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/variables-from-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ export class VariablesFromFiles {
const {type, values} = unpack(val);
for (const [matcher, content] of Object.entries(values)) {
assert(typeof content == "string", `${key}.${matcher} content must be text or multiline text`);
if (isDotEnv || type === "variable" || (type === null && !/^[/|~]/.exec(content))) {
if (isDotEnv || type === "variable" || (type === null && !/^[/~]/.exec(content))) {
const regexp = matcher === "*" ? /.*/g : new RegExp(`^${matcher.replace(/\*/g, ".*")}$`, "g");
variables[key] = variables[key] ?? {type: "variable", environments: []};
variables[key].environments.push({content, regexp, regexpPriority: matcher.length, scopePriority});
} else if (type === null && /^[/|~]/.exec(content)) {
} else if (type === null && /^[/~]/.exec(content)) {
const fileSource = content.replace(/^~\/(.*)/, `${homeDir}/$1`);
const regexp = matcher === "*" ? /.*/g : new RegExp(`^${matcher.replace(/\*/g, ".*")}$`, "g");
variables[key] = variables[key] ?? {type: "file", environments: []};
Expand Down

0 comments on commit 8ec9299

Please sign in to comment.