fix(xo-server): use encodeURIComponent for filenames

This makes sure special characters like `?` or `#` are correctly handled.
This commit is contained in:
Julien Fontanet
2019-09-10 14:39:53 +02:00
parent c44ef6a1dc
commit 4d79c462db
3 changed files with 3 additions and 3 deletions

View File

@@ -302,7 +302,7 @@ export async function fetchFiles(params) {
filename += '.zip'
return this.registerHttpRequest(handleFetchFiles, params, {
suffix: encodeURI(`/${filename}`),
suffix: '/' + encodeURIComponent(filename),
}).then(url => ({ $getFrom: url }))
}

View File

@@ -93,7 +93,7 @@ export async function fetchFiles({ format = 'zip', ...params }) {
handleFetchFiles,
{ ...params, format },
{
suffix: encodeURI(`/${fileName}`),
suffix: '/' + encodeURIComponent(fileName),
}
).then(url => ({ $getFrom: url }))
}

View File

@@ -1189,7 +1189,7 @@ async function export_({ vm, compress }) {
return {
$getFrom: await this.registerHttpRequest(handleExport, data, {
suffix: encodeURI(`/${vm.name_label}.xva`),
suffix: '/' + encodeURIComponent(`${vm.name_label}.xva`),
}),
}
}