commit 39e10a48af5f26e1412a2e62a21405c1f26324fc
parent 1b4ff2f45f2b91448bc75fedd35eb48d49f057f4
Author: Florian Dold <dold@taler.net>
Date: Tue, 21 Jul 2026 20:00:34 +0200
util: keep the whole substitution default after the first ":-"
split(":-", 2) discards everything past the second field, so the default of
${X:-a:-b} was "a". The C takes the rest of the expression verbatim.
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/packages/taler-util/src/talerconfig.ts b/packages/taler-util/src/talerconfig.ts
@@ -246,7 +246,11 @@ export function pathsub(
let varname: string;
let defaultValue: string | undefined;
if (hasDefault) {
- [varname, defaultValue] = inner.split(":-", 2);
+ // Split at the first ":-" only: the default is the whole rest of
+ // the expression, as in the C, and may itself contain ":-".
+ const sep = inner.indexOf(":-");
+ varname = inner.slice(0, sep);
+ defaultValue = inner.slice(sep + 2);
} else {
varname = inner;
defaultValue = undefined;