aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2024-12-02 16:02:02 -0800
committerAndy Scherzinger <info@andy-scherzinger.de>2025-02-05 09:09:03 +0100
commit2159fb04f4e4daa3df014e268305416d3e081f62 (patch)
treea4efde86e663b133e6813b33098a7d8825fcaceb
parent68829ad47c15ae819e5d87cc4cc7d8fc8f220e12 (diff)
downloadnextcloud-server-2159fb04f4e4daa3df014e268305416d3e081f62.tar.gz
nextcloud-server-2159fb04f4e4daa3df014e268305416d3e081f62.zip
feat(files): Display meaningful error message on move failure
Signed-off-by: Christopher Ng <chrng8@gmail.com>
-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 c33b685845b..8c02c62ca25 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)