Fixed issue where Dragged & Dropped folder from desktop didn't start uploading

This commit is contained in:
Čarodej
2022-06-23 11:44:23 +02:00
parent 0485672a47
commit e412f3b88b
11 changed files with 104 additions and 34 deletions

View File

@@ -190,7 +190,38 @@ const FunctionHelpers = {
})
// Start uploading if uploading process isn't running
if (store.getters.filesInQueueTotal === 0) this.$handleUploading(store.getters.fileQueue[0])
if (store.getters.filesInQueueTotal === 0) {
this.$handleUploading(store.getters.fileQueue[0])
}
// Increase total files in upload bar
store.commit('INCREASE_FILES_IN_QUEUES_TOTAL', files.length)
}
Vue.prototype.$uploadDraggedFolderOrFile = async function (files, parent_id) {
files.map((file) => {
// Get file path
let filePath = file.filepath ? '/' + file.filepath : undefined
// Determine if we are uploading folder or file
if (filePath.split('/').length > 2) {
store.commit('UPDATE_UPLOADING_FOLDER_STATE', true)
}
// Push file to the upload queue
if (file.name !== '.DS_Store') {
store.commit('ADD_FILES_TO_QUEUE', {
parent_id: parent_id || '',
path: filePath,
file: file,
})
}
})
// Start uploading if uploading process isn't running
if (store.getters.filesInQueueTotal === 0) {
this.$handleUploading(store.getters.fileQueue[0])
}
// Increase total files in upload bar
store.commit('INCREASE_FILES_IN_QUEUES_TOTAL', files.length)
@@ -208,7 +239,7 @@ const FunctionHelpers = {
if (event.dataTransfer.items.length === 0) return // Push items to file queue
;[...event.dataTransfer.items].map((item) => {
store.commit('ADD_FILES_TO_QUEUE', {
parent_id: parent_id ? parent_id : '',
parent_id: parent_id || '',
file: item.getAsFile(),
})
})