|
22 | 22 | import '@nextcloud/dialogs/style.css' |
23 | 23 | import type { Folder, Node, View } from '@nextcloud/files' |
24 | 24 | import type { IFilePickerButton } from '@nextcloud/dialogs' |
25 | | -import type { FileStat, ResponseDataDetailed } from 'webdav' |
| 25 | +import type { FileStat, ResponseDataDetailed, WebDAVClientError } from 'webdav' |
26 | 26 | import type { MoveCopyResult } from './moveOrCopyActionUtils' |
27 | 27 |
|
28 | 28 | import { FilePickerClosed, getFilePickerBuilder, showError, showInfo, TOAST_PERMANENT_TIMEOUT } from '@nextcloud/dialogs' |
@@ -184,7 +184,18 @@ export const handleCopyMoveNodeTo = async (node: Node, destination: Folder, meth |
184 | 184 | } |
185 | 185 | // getting here means either no conflict, file was renamed to keep both files |
186 | 186 | // in a conflict, or the selected file was chosen to be kept during the conflict |
187 | | - await client.moveFile(currentPath, join(destinationPath, node.basename)) |
| 187 | + try { |
| 188 | + await client.moveFile(currentPath, join(destinationPath, node.basename)) |
| 189 | + } catch (error) { |
| 190 | + const parser = new DOMParser() |
| 191 | + const text = await (error as WebDAVClientError).response?.text() |
| 192 | + const message = parser.parseFromString(text ?? '', 'text/xml') |
| 193 | + .querySelector('message')?.textContent |
| 194 | + if (message) { |
| 195 | + showError(message) |
| 196 | + } |
| 197 | + throw error |
| 198 | + } |
188 | 199 | // Delete the node as it will be fetched again |
189 | 200 | // when navigating to the destination folder |
190 | 201 | emit('files:node:deleted', node) |
|
0 commit comments