summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2023-10-03 17:45:17 +0200
committerDaniel Kesselberg <mail@danielkesselberg.de>2023-10-03 17:46:16 +0200
commitce0cc84c21c6ef8e4be207f9ed050dbaf52896c6 (patch)
treebc4a363312d98504c1d2d7cc8fba32512b52cc80 /apps/files_trashbin
parentffe533d3fc42677d0b7dbe65af6b1d6487137060 (diff)
downloadnextcloud-server-ce0cc84c21c6ef8e4be207f9ed050dbaf52896c6.tar.gz
nextcloud-server-ce0cc84c21c6ef8e4be207f9ed050dbaf52896c6.zip
fix: encode uri for trashbin delete
Replace d280912f31756593fb877ad3c6129399a30e019b with a cleaner approach. Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r--apps/files_trashbin/src/actions/restoreAction.ts5
-rw-r--r--apps/files_trashbin/src/services/trashbin.ts2
2 files changed, 5 insertions, 2 deletions
diff --git a/apps/files_trashbin/src/actions/restoreAction.ts b/apps/files_trashbin/src/actions/restoreAction.ts
index d3e3f66a1df..f464602f01c 100644
--- a/apps/files_trashbin/src/actions/restoreAction.ts
+++ b/apps/files_trashbin/src/actions/restoreAction.ts
@@ -51,11 +51,14 @@ registerFileAction(new FileAction({
},
async exec(node: Node) {
+ const { origin } = new URL(node.source)
+ const encodedSource = origin + encodePath(node.source.slice(origin.length))
+
try {
const destination = generateRemoteUrl(encodePath(`dav/trashbin/${getCurrentUser()?.uid}/restore/${node.basename}`))
await axios({
method: 'MOVE',
- url: node.source,
+ url: encodedSource,
headers: {
destination,
},
diff --git a/apps/files_trashbin/src/services/trashbin.ts b/apps/files_trashbin/src/services/trashbin.ts
index 6027765dc4d..1c91e420557 100644
--- a/apps/files_trashbin/src/services/trashbin.ts
+++ b/apps/files_trashbin/src/services/trashbin.ts
@@ -58,7 +58,7 @@ const resultToNode = function(node: FileStat): File | Folder {
const nodeData = {
id: node.props?.fileid as number || 0,
- source: generateRemoteUrl(encodePath('dav' + rootPath + node.filename)),
+ source: generateRemoteUrl('dav' + rootPath + node.filename),
mtime: new Date(node.lastmod),
mime: node.mime as string,
size: node.props?.size as number || 0,