mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
fix(files): make sure drag-and-drop and the upload menu behaves the same
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
e4f06e102f
commit
d6925b6b79
2 changed files with 12 additions and 10 deletions
|
|
@ -90,10 +90,11 @@ export async function dataTransferToFileTree(items: DataTransferItem[]): Promise
|
|||
}
|
||||
|
||||
/**
|
||||
* Handle dropping external files
|
||||
*
|
||||
* @param root
|
||||
* @param destination
|
||||
* @param contents
|
||||
* @param root - The root directory which should be uploaded
|
||||
* @param destination - The destination folder
|
||||
* @param contents - The contents of the destination folder
|
||||
*/
|
||||
export async function onDropExternalFiles(root: RootDirectory, destination: Folder, contents: Node[]): Promise<Upload[]> {
|
||||
const uploader = getUploader()
|
||||
|
|
@ -101,9 +102,11 @@ export async function onDropExternalFiles(root: RootDirectory, destination: Fold
|
|||
// Check for conflicts on root elements
|
||||
if (await hasConflict(root.contents, contents)) {
|
||||
root.contents = await resolveConflict(root.contents, destination, contents)
|
||||
}
|
||||
|
||||
if (root.contents.length === 0) {
|
||||
if (root.contents.length === 0) {
|
||||
// user cancelled the upload
|
||||
return []
|
||||
}
|
||||
} else if (root.contents.length === 0) {
|
||||
logger.info('No files to upload', { root })
|
||||
showInfo(t('files', 'No files to upload'))
|
||||
return []
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import type { Folder, Node } from '@nextcloud/files'
|
|||
*/
|
||||
import type { FileStat, ResponseDataDetailed } from 'webdav'
|
||||
|
||||
import { showError, showInfo } from '@nextcloud/dialogs'
|
||||
import { showInfo, showWarning } from '@nextcloud/dialogs'
|
||||
import { emit } from '@nextcloud/event-bus'
|
||||
import { davGetClient, davGetDefaultPropfind, davResultToNode } from '@nextcloud/files'
|
||||
import { translate as t } from '@nextcloud/l10n'
|
||||
|
|
@ -179,10 +179,9 @@ export async function resolveConflict<T extends ((Directory | File) | Node)>(fil
|
|||
// Update the list of files to upload
|
||||
return [...uploads, ...selected, ...renamed] as (typeof files)
|
||||
} catch (error) {
|
||||
logger.error(error as Error)
|
||||
// User cancelled
|
||||
showError(t('files', 'Upload cancelled'))
|
||||
logger.error('User cancelled the upload')
|
||||
logger.warn('User cancelled the upload', { error })
|
||||
showWarning(t('files', 'Upload cancelled'))
|
||||
}
|
||||
|
||||
return []
|
||||
|
|
|
|||
Loading…
Reference in a new issue