diff options
Diffstat (limited to 'src/util/urls.js')
-rw-r--r-- | src/util/urls.js | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/util/urls.js b/src/util/urls.js index c2119b8d..ad912908 100644 --- a/src/util/urls.js +++ b/src/util/urls.js @@ -79,16 +79,23 @@ export function generateURLs(urlSpec) { ); const toHelper = - (delimiterMode) => + ({device}) => (key, ...args) => { const { - value: {[delimiterMode]: template}, + value: { + [device ? 'device' : 'posix']: template, + }, } = getValueForFullKey(relative, key); let missing = 0; let result = template.replaceAll(/<([0-9]+)>/g, (match, n) => { if (n < args.length) { - return args[n]; + const value = args[n]; + if (device) { + return value; + } else { + return encodeURIComponent(value); + } } else { missing++; } @@ -106,8 +113,8 @@ export function generateURLs(urlSpec) { }; return { - to: toHelper('posix'), - toDevice: toHelper('device'), + to: toHelper({device: false}), + toDevice: toHelper({device: true}), }; }; |