From fb22644cfb5c1a3b72d672f2940ebade870e5b48 Mon Sep 17 00:00:00 2001 From: Jonas Date: Mon, 27 Apr 2026 17:06:53 +0200 Subject: [PATCH] fix(files): fix custom client-side error messages on move/copy actions move/copy actions don't use axios these days. Signed-off-by: Jonas --- apps/files/src/actions/moveOrCopyAction.ts | 29 ++++++++++------------ 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/apps/files/src/actions/moveOrCopyAction.ts b/apps/files/src/actions/moveOrCopyAction.ts index 0826f11610d..68f00f48ce2 100644 --- a/apps/files/src/actions/moveOrCopyAction.ts +++ b/apps/files/src/actions/moveOrCopyAction.ts @@ -10,7 +10,6 @@ import type { MoveCopyResult } from './moveOrCopyActionUtils.ts' import FolderMoveSvg from '@mdi/svg/svg/folder-move-outline.svg?raw' import CopyIconSvg from '@mdi/svg/svg/folder-multiple-outline.svg?raw' -import { isAxiosError } from '@nextcloud/axios' import { FilePickerClosed, getFilePickerBuilder, openConflictPicker, showError, showLoading } from '@nextcloud/dialogs' import { emit } from '@nextcloud/event-bus' import { FileType, getUniqueName, NodeStatus, Permission } from '@nextcloud/files' @@ -191,21 +190,19 @@ export async function* handleCopyMoveNodesTo(nodes: INode[], destination: IFolde } } catch (error) { logger.debug(`Error while trying to ${method === MoveCopyAction.COPY ? 'copy' : 'move'} node`, { node, error }) - if (isAxiosError(error)) { - if (error.response?.status === 412) { - throw new HintException(t('files', 'A file or folder with that name already exists in this folder')) - } else if (error.response?.status === 423) { - throw new HintException(t('files', 'The files are locked')) - } else if (error.response?.status === 404) { - throw new HintException(t('files', 'The file does not exist anymore')) - } else if ('response' in error && error.response) { - const parser = new DOMParser() - const text = await (error as WebDAVClientError).response!.text() - const message = parser.parseFromString(text ?? '', 'text/xml') - .querySelector('message')?.textContent - if (message) { - throw new HintException(message) - } + if (error.response?.status === 412) { + throw new HintException(t('files', 'A file or folder with that name already exists in this folder')) + } else if (error.response?.status === 423) { + throw new HintException(t('files', 'The files are locked')) + } else if (error.response?.status === 404) { + throw new HintException(t('files', 'The file does not exist anymore')) + } else if ('response' in error && error.response) { + const parser = new DOMParser() + const text = await (error as WebDAVClientError).response!.text() + const message = parser.parseFromString(text ?? '', 'text/xml') + .querySelector('message')?.textContent + if (message) { + throw new HintException(message) } } throw error