From 264eadd104d76d5b683fa5195e46b4b1c5e6cd8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Tue, 3 Oct 2023 16:49:49 +0200 Subject: [PATCH] fix(files): encoded source path on actions requests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- apps/files/src/actions/deleteAction.ts | 2 +- apps/files/src/components/FileEntry.vue | 7 ++++--- apps/files/src/services/Files.ts | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/files/src/actions/deleteAction.ts b/apps/files/src/actions/deleteAction.ts index 18c18178cb7c8..f79872f16851b 100644 --- a/apps/files/src/actions/deleteAction.ts +++ b/apps/files/src/actions/deleteAction.ts @@ -44,7 +44,7 @@ export const action = new FileAction({ async exec(node: Node) { try { - await axios.delete(node.source) + await axios.delete(node.encodedSource) // Let's delete even if it's moved to the trashbin // since it has been removed from the current view diff --git a/apps/files/src/components/FileEntry.vue b/apps/files/src/components/FileEntry.vue index fc7c0a4af5145..275e8bb3aefa2 100644 --- a/apps/files/src/components/FileEntry.vue +++ b/apps/files/src/components/FileEntry.vue @@ -845,7 +845,7 @@ export default Vue.extend({ // Rename and move the file async onRename() { const oldName = this.source.basename - const oldSource = this.source.source + const oldEncodedSource = this.source.encodedSource const newName = this.newName.trim?.() || '' if (newName === '') { showError(this.t('files', 'Name cannot be empty')) @@ -870,12 +870,13 @@ export default Vue.extend({ // Update node this.source.rename(newName) + logger.debug('Moving file to', { destination: this.source.encodedSource, oldEncodedSource }) try { await axios({ method: 'MOVE', - url: oldSource, + url: oldEncodedSource, headers: { - Destination: encodeURI(this.source.source), + Destination: this.source.encodedSource, }, }) diff --git a/apps/files/src/services/Files.ts b/apps/files/src/services/Files.ts index c87569281917c..c09be2d72acae 100644 --- a/apps/files/src/services/Files.ts +++ b/apps/files/src/services/Files.ts @@ -30,7 +30,6 @@ import { getCurrentUser } from '@nextcloud/auth' import { getClient, rootPath } from './WebdavClient' import { hashCode } from '../utils/hashUtils' import logger from '../logger' -import { encodePath } from '@nextcloud/paths' const client = getClient() @@ -45,7 +44,7 @@ export const resultToNode = function(node: FileStat): File | Folder { const permissions = davParsePermissions(props?.permissions) const owner = getCurrentUser()?.uid as string - const source = generateRemoteUrl(encodePath('dav' + rootPath + node.filename)) + const source = generateRemoteUrl('dav' + rootPath + node.filename) const id = props?.fileid < 0 ? hashCode(source) : props?.fileid as number || 0