commit 74de25129b1f7e219e7277596eba67d258f838dc
parent 0a6041484a65b7f27c66022dce6ea502540225e3
Author: Florian Dold <dold@taler.net>
Date: Tue, 21 Jul 2026 20:01:16 +0200
util: split the @inline-secret@ arguments as the C does
Splitting on every space and demanding exactly two fields rejected aligned
directives and paths containing a space. The C ends the section name at
the first space and takes the rest of the line as the path.
Diffstat:
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/packages/taler-util/src/talerconfig.ts b/packages/taler-util/src/talerconfig.ts
@@ -574,17 +574,22 @@ export class Configuration {
);
}
const arg = directiveMatch[2].trim();
- const sp = arg.split(" ").map((x) => x.trim());
- if (sp.length != 2) {
+ // The section name ends at the first space and the path is the
+ // rest of the line, as in the C. Splitting on every space
+ // rejected aligned directives and paths containing a space.
+ const sepPos = arg.indexOf(" ");
+ const secretSection = sepPos < 0 ? "" : arg.slice(0, sepPos);
+ const secretPath = sepPos < 0 ? "" : arg.slice(sepPos).trim();
+ if (!secretSection || !secretPath) {
throw Error(
`invalid configuration, @inline-secret@ directive in ${fn}:${lineNo} requires two arguments`,
);
}
const secretFilename = normalizeInlineFilename(
opts.filename,
- sp[1],
+ secretPath,
);
- this.loadSecret(sp[0], secretFilename, isDefaultSource);
+ this.loadSecret(secretSection, secretFilename, isDefaultSource);
break;
}
case "inline-matching": {