From 7b429c8a4405326de14ce51c41fc18df9c43fb5f Mon Sep 17 00:00:00 2001 From: Fabian Zwemke Date: Tue, 25 Mar 2025 12:03:26 +0100 Subject: [PATCH] fix(files): Properly encode URLs when preparing ZIP download Signed-off-by: Fabian Zwemke --- apps/files/src/actions/downloadAction.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/files/src/actions/downloadAction.ts b/apps/files/src/actions/downloadAction.ts index 32f029d777c..777008c804e 100644 --- a/apps/files/src/actions/downloadAction.ts +++ b/apps/files/src/actions/downloadAction.ts @@ -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)) }