Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix root folder links in the upload overlay #6846

Merged
merged 3 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-upload-overlay-links
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Upload overlay links

We've fixed a bug where the folder links in the upload overlay were broken when navigating into another app or file list.

https://github.com/owncloud/web/pull/6846
https://github.com/owncloud/web/issues/6819
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ export default defineComponent({

resource = buildResource(resource)

this.$uppyService.publish('uploadedFileFetched', {
uppyResource: file,
fetchedFile: resource
})

// Update table only if the file was uploaded to the current directory
if (fileIsInCurrentPath) {
this.UPSERT_RESOURCE(resource)
Expand Down
11 changes: 11 additions & 0 deletions packages/web-app-files/src/views/FilesDrop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default {

onMounted(() => {
const filesSelectedSub = uppyService.subscribe('filesSelected', instance.onFilesSelected)
const uploadSuccessSub = uppyService.subscribe('uploadSuccess', instance.onFileSuccess)
const uploadErrorSub = uppyService.subscribe('uploadError', instance.onFileError)

uppyService.useDropTarget({
Expand All @@ -62,6 +63,7 @@ export default {

instance.$on('beforeDestroy', () => {
uppyService.unsubscribe('filesSelected', filesSelectedSub)
uppyService.unsubscribe('uploadSuccess', uploadSuccessSub)
uppyService.unsubscribe('uploadError', uploadErrorSub)
uppyService.removeDropTarget()
})
Expand Down Expand Up @@ -162,6 +164,15 @@ export default {
this.$uppyService.uploadFiles(uppyResources)
},

onFileSuccess(uppyResource) {
this.$uppyService.publish('uploadedFileFetched', {
uppyResource,
fetchedFile: {
name: uppyResource.name
}
})
},

onFileError(error) {
console.error(error)
this.showMessage({
Expand Down
18 changes: 5 additions & 13 deletions packages/web-runtime/src/components/UploadInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,10 @@ export default {
this.closeInfo()
}
})
this.$uppyService.subscribe('uploadSuccess', (file) => {
// @TODO we need the storage ID here... maybe fetch the file via DAV and call buildResources()?

let path = file.meta.currentFolder
if (file.meta.relativePath) {
path += file.meta.relativePath
}
path += file.name

this.$uppyService.subscribe('uploadedFileFetched', ({ uppyResource, fetchedFile }) => {
this.successfulUploads.push({
...file,
path,
targetRoute: file.meta.route
...fetchedFile,
targetRoute: uppyResource.meta.route
})
})
},
Expand Down Expand Up @@ -169,7 +160,8 @@ export default {
name: targetRoute.name,
query: targetRoute.query,
params: {
...(storageId && path && { storageId })
...(storageId && path && { storageId }),
...(targetRoute.params?.storage && { storage: targetRoute.params?.storage })
}
}

Expand Down