mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #59954 from nextcloud/backport/59935/stable33
[stable33] fix(files): fix custom client-side error messages on move/copy actions
This commit is contained in:
commit
809b775a43
5 changed files with 19 additions and 22 deletions
|
|
@ -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
|
||||
|
|
|
|||
4
dist/files-init.js
vendored
4
dist/files-init.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-init.js.map
vendored
2
dist/files-init.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/files-main.js
vendored
4
dist/files-main.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-main.js.map
vendored
2
dist/files-main.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue