From f8ecb74109e0288f54d6f8d991f9a355c0e5921b Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Tue, 10 May 2022 16:59:54 +0200 Subject: [PATCH] Fix downloads on shared with me page --- changelog/unreleased/bugfix-share-downloads | 6 ++++++ packages/web-app-files/src/helpers/resources.ts | 2 +- .../web-app-files/src/mixins/actions/downloadArchive.js | 4 +++- packages/web-app-files/src/mixins/actions/downloadFile.js | 4 +++- 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 changelog/unreleased/bugfix-share-downloads diff --git a/changelog/unreleased/bugfix-share-downloads b/changelog/unreleased/bugfix-share-downloads new file mode 100644 index 00000000000..b7e400daa6e --- /dev/null +++ b/changelog/unreleased/bugfix-share-downloads @@ -0,0 +1,6 @@ +Bugfix: Share downloads + +Both single file and folder shares didn't have the download action available on the `Shared with me` page. We've fixed this by allowing the shared with me route for download actions and by fixing a download permission check on shares. + +https://github.com/owncloud/ocis/issues/3760 +https://github.com/owncloud/web/pull/6936 diff --git a/packages/web-app-files/src/helpers/resources.ts b/packages/web-app-files/src/helpers/resources.ts index 258eae26a2e..d3015baff73 100644 --- a/packages/web-app-files/src/helpers/resources.ts +++ b/packages/web-app-files/src/helpers/resources.ts @@ -388,7 +388,7 @@ export function buildSharedResource( resource.path = share.file_target resource.webDavPath = buildWebDavFilesPath(share.share_with, share.file_target) } - resource.canDownload = () => share.state === ShareStatus.accepted + resource.canDownload = () => parseInt(share.state) === ShareStatus.accepted resource.canShare = () => SharePermissions.share.enabled(share.permissions) resource.canRename = () => SharePermissions.update.enabled(share.permissions) resource.canBeDeleted = () => SharePermissions.delete.enabled(share.permissions) diff --git a/packages/web-app-files/src/mixins/actions/downloadArchive.js b/packages/web-app-files/src/mixins/actions/downloadArchive.js index 800c5719ff4..79e3c7ad523 100644 --- a/packages/web-app-files/src/mixins/actions/downloadArchive.js +++ b/packages/web-app-files/src/mixins/actions/downloadArchive.js @@ -1,6 +1,7 @@ import { isLocationCommonActive, isLocationPublicActive, + isLocationSharesActive, isLocationSpacesActive } from '../../router' import isFilesAppActive from './helpers/isFilesAppActive' @@ -27,7 +28,8 @@ export default { !isLocationSpacesActive(this.$router, 'files-spaces-project') && !isLocationSpacesActive(this.$router, 'files-spaces-share') && !isLocationPublicActive(this.$router, 'files-public-files') && - !isLocationCommonActive(this.$router, 'files-common-favorites') + !isLocationCommonActive(this.$router, 'files-common-favorites') && + !isLocationSharesActive(this.$router, 'files-shares-with-me') ) { return false } diff --git a/packages/web-app-files/src/mixins/actions/downloadFile.js b/packages/web-app-files/src/mixins/actions/downloadFile.js index a24438e2021..8705ebbac3d 100644 --- a/packages/web-app-files/src/mixins/actions/downloadFile.js +++ b/packages/web-app-files/src/mixins/actions/downloadFile.js @@ -1,6 +1,7 @@ import { isLocationCommonActive, isLocationPublicActive, + isLocationSharesActive, isLocationSpacesActive } from '../../router' import isFilesAppActive from './helpers/isFilesAppActive' @@ -24,7 +25,8 @@ export default { !isLocationSpacesActive(this.$router, 'files-spaces-project') && !isLocationSpacesActive(this.$router, 'files-spaces-share') && !isLocationPublicActive(this.$router, 'files-public-files') && - !isLocationCommonActive(this.$router, 'files-common-favorites') + !isLocationCommonActive(this.$router, 'files-common-favorites') && + !isLocationSharesActive(this.$router, 'files-shares-with-me') ) { return false }