Skip to content

Commit

Permalink
Merge pull request #6846 from owncloud/fix-upload-overlay-folder-links
Browse files Browse the repository at this point in the history
Fix root folder links in the upload overlay
  • Loading branch information
JammingBen authored May 4, 2022
2 parents 141691a + f244550 commit c7ca5d4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
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

0 comments on commit c7ca5d4

Please sign in to comment.