mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 00:32:29 -04:00
fix(files): Properly encode URLs when preparing ZIP download
Signed-off-by: Fabian Zwemke <fabian@zwemke.de>
This commit is contained in:
parent
f61446e843
commit
7b429c8a44
1 changed files with 3 additions and 3 deletions
|
|
@ -55,15 +55,15 @@ const downloadNodes = function(nodes: Node[]) {
|
|||
url.searchParams.append('accept', 'zip')
|
||||
}
|
||||
} else {
|
||||
url = new URL(nodes[0].source)
|
||||
url = new URL(nodes[0].encodedSource)
|
||||
let base = url.pathname
|
||||
for (const node of nodes.slice(1)) {
|
||||
base = longestCommonPath(base, (new URL(node.source).pathname))
|
||||
base = longestCommonPath(base, (new URL(node.encodedSource).pathname))
|
||||
}
|
||||
url.pathname = base
|
||||
|
||||
// The URL contains the path encoded so we need to decode as the query.append will re-encode it
|
||||
const filenames = nodes.map((node) => decodeURI(node.encodedSource.slice(url.href.length + 1)))
|
||||
const filenames = nodes.map((node) => decodeURIComponent(node.encodedSource.slice(url.href.length + 1)))
|
||||
url.searchParams.append('accept', 'zip')
|
||||
url.searchParams.append('files', JSON.stringify(filenames))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue