aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2024-12-02 16:02:02 -0800
committerRobin Appelman <robin@icewind.nl>2025-01-03 15:36:38 +0100
commiteb902a49750fbbb902edfe52a017ffd38d23f4b0 (patch)
treec6434a79f619e66dbec709a3c391f0b291b510d9 /apps/files
parent16d03639373d77aa2c90cb7220319d57042b7376 (diff)
downloadnextcloud-server-eb902a49750fbbb902edfe52a017ffd38d23f4b0.tar.gz
nextcloud-server-eb902a49750fbbb902edfe52a017ffd38d23f4b0.zip
feat(files): Display meaningful error message on move failure
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/src/actions/moveOrCopyAction.ts15
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/files/src/actions/moveOrCopyAction.ts b/apps/files/src/actions/moveOrCopyAction.ts
index 1f1de939d7c..36bb7c41712 100644
--- a/apps/files/src/actions/moveOrCopyAction.ts
+++ b/apps/files/src/actions/moveOrCopyAction.ts
@@ -4,7 +4,7 @@
*/
import type { Folder, Node, View } from '@nextcloud/files'
import type { IFilePickerButton } from '@nextcloud/dialogs'
-import type { FileStat, ResponseDataDetailed } from 'webdav'
+import type { FileStat, ResponseDataDetailed, WebDAVClientError } from 'webdav'
import type { MoveCopyResult } from './moveOrCopyActionUtils'
import { isAxiosError } from '@nextcloud/axios'
@@ -165,7 +165,18 @@ export const handleCopyMoveNodeTo = async (node: Node, destination: Folder, meth
}
// getting here means either no conflict, file was renamed to keep both files
// in a conflict, or the selected file was chosen to be kept during the conflict
- await client.moveFile(currentPath, join(destinationPath, node.basename))
+ try {
+ await client.moveFile(currentPath, join(destinationPath, node.basename))
+ } catch (error) {
+ const parser = new DOMParser()
+ const text = await (error as WebDAVClientError).response?.text()
+ const message = parser.parseFromString(text ?? '', 'text/xml')
+ .querySelector('message')?.textContent
+ if (message) {
+ showError(message)
+ }
+ throw error
+ }
// Delete the node as it will be fetched again
// when navigating to the destination folder
emit('files:node:deleted', node)