diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2023-10-03 16:49:49 +0200 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2023-10-03 18:11:03 +0200 |
commit | d79e26b25a4a5f3e692439d9ab913f0e078a7785 (patch) | |
tree | 79e5a22946221d9d5f873040e00431809daba239 /apps | |
parent | 8f30f976425d6ee933cfc47cb5ed82d827ff5106 (diff) | |
download | nextcloud-server-d79e26b25a4a5f3e692439d9ab913f0e078a7785.tar.gz nextcloud-server-d79e26b25a4a5f3e692439d9ab913f0e078a7785.zip |
fix(files): encoded source path on actions requests
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/src/actions/deleteAction.ts | 2 | ||||
-rw-r--r-- | apps/files/src/actions/moveOrCopyAction.ts | 4 | ||||
-rw-r--r-- | apps/files/src/components/FileEntry.vue | 7 | ||||
-rw-r--r-- | apps/files/src/newMenu/newFolder.ts | 2 | ||||
-rw-r--r-- | apps/files/src/services/Files.ts | 3 | ||||
-rw-r--r-- | apps/files_trashbin/src/actions/restoreAction.ts | 2 | ||||
-rw-r--r-- | apps/files_trashbin/src/services/trashbin.ts | 2 |
7 files changed, 11 insertions, 11 deletions
diff --git a/apps/files/src/actions/deleteAction.ts b/apps/files/src/actions/deleteAction.ts index 18c18178cb7..f79872f1685 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/actions/moveOrCopyAction.ts b/apps/files/src/actions/moveOrCopyAction.ts index 51113f7ba31..52ad4f2868d 100644 --- a/apps/files/src/actions/moveOrCopyAction.ts +++ b/apps/files/src/actions/moveOrCopyAction.ts @@ -86,7 +86,7 @@ export const handleCopyMoveNodeTo = async (node: Node, destination: Folder, meth } const relativePath = join(destination.path, node.basename) - const destinationUrl = generateRemoteUrl(`dav/files/${getCurrentUser()?.uid}${relativePath}`) + const destinationUrl = generateRemoteUrl(encodePath(`dav/files/${getCurrentUser()?.uid}${relativePath}`)) logger.debug(`${method} ${node.basename} to ${destinationUrl}`) // Set loading state @@ -97,7 +97,7 @@ export const handleCopyMoveNodeTo = async (node: Node, destination: Folder, meth try { await axios({ method: method === MoveCopyAction.COPY ? 'COPY' : 'MOVE', - url: encodeURI(node.source), + url: node.encodedSource, headers: { Destination: encodeURI(destinationUrl), Overwrite: overwrite ? undefined : 'F', diff --git a/apps/files/src/components/FileEntry.vue b/apps/files/src/components/FileEntry.vue index fc7c0a4af51..275e8bb3aef 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/newMenu/newFolder.ts b/apps/files/src/newMenu/newFolder.ts index 33fd113b7c3..a7fa38c706c 100644 --- a/apps/files/src/newMenu/newFolder.ts +++ b/apps/files/src/newMenu/newFolder.ts @@ -70,7 +70,7 @@ export const entry = { async handler(context: Folder, content: Node[]) { const contentNames = content.map((node: Node) => node.basename) const name = getUniqueName(t('files', 'New folder'), contentNames) - const { fileid, source } = await createNewFolder(context.source, name) + const { fileid, source } = await createNewFolder(context.encodedSource, encodeURIComponent(name)) // Create the folder in the store const folder = new Folder({ diff --git a/apps/files/src/services/Files.ts b/apps/files/src/services/Files.ts index c8756928191..c09be2d72ac 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 diff --git a/apps/files_trashbin/src/actions/restoreAction.ts b/apps/files_trashbin/src/actions/restoreAction.ts index ab9ac784d7f..e03573a75a6 100644 --- a/apps/files_trashbin/src/actions/restoreAction.ts +++ b/apps/files_trashbin/src/actions/restoreAction.ts @@ -54,7 +54,7 @@ registerFileAction(new FileAction({ const destination = generateRemoteUrl(encodePath(`dav/trashbin/${getCurrentUser()?.uid}/restore/${node.basename}`)) await axios({ method: 'MOVE', - url: node.source, + url: node.encodedSource, headers: { destination, }, diff --git a/apps/files_trashbin/src/services/trashbin.ts b/apps/files_trashbin/src/services/trashbin.ts index d9ac3c7c70c..9aef75ef6d5 100644 --- a/apps/files_trashbin/src/services/trashbin.ts +++ b/apps/files_trashbin/src/services/trashbin.ts @@ -46,7 +46,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), // do not show the mtime column // mtime: new Date(node.lastmod), mime: node.mime as string, |