Trim whitespace and quotes in variable substitution
This commit is contained in:
parent
861a3d2091
commit
c055d6a1ba
@ -59,7 +59,10 @@ export function substituteEnvironmentVars(str) {
|
||||
const cachedVars = getCachedEnvironmentVars();
|
||||
cachedVars.forEach(([key, value]) => {
|
||||
if (key.startsWith(homepageVarPrefix)) {
|
||||
result = result.replaceAll(`{{${key}}}`, value);
|
||||
// Remove whitespace and quotes on edges of the string
|
||||
// Leave quotes in the middle of the string in
|
||||
const sanitizedValue = value.replace(/^[\s"']+|[\s"']+$/g, '');
|
||||
result = result.replaceAll(`{{${key}}}`, sanitizedValue);
|
||||
} else if (key.startsWith(homepageFilePrefix)) {
|
||||
const filename = value;
|
||||
const fileContents = readFileSync(filename, "utf8");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user