From b0f9113eba70a4c7e647e12d2c0998e98c67d88d Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Sat, 28 Oct 2023 16:26:42 +0200 Subject: fix: encode uri for trashbin delete Replace d280912 with a cleaner approach. Signed-off-by: Daniel Kesselberg --- apps/files/src/actions/deleteAction.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'apps/files/src') diff --git a/apps/files/src/actions/deleteAction.ts b/apps/files/src/actions/deleteAction.ts index a633e477b1f..d4cf607d0fc 100644 --- a/apps/files/src/actions/deleteAction.ts +++ b/apps/files/src/actions/deleteAction.ts @@ -28,6 +28,7 @@ import TrashCan from '@mdi/svg/svg/trash-can.svg?raw' import { registerFileAction, FileAction } from '../services/FileAction.ts' import logger from '../logger.js' import type { Navigation } from '../services/Navigation.ts' +import { encodePath } from '@nextcloud/paths'; registerFileAction(new FileAction({ id: 'delete', @@ -45,8 +46,11 @@ registerFileAction(new FileAction({ }, async exec(node: Node) { + const { origin } = new URL(node.source) + const encodedSource = origin + encodePath(node.source.slice(origin.length)) + try { - await axios.delete(node.source) + await axios.delete(encodedSource) // Let's delete even if it's moved to the trashbin // since it has been removed from the current view -- cgit v1.2.3