Skip to content

Commit 53e8da0

Browse files
committed
fix: allow downloading vault roots
1 parent 16bf753 commit 53e8da0

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎packages/web-app-files/src/composables/actions/files/useFileActionsDownloadArchive.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ import {
55
FileAction,
66
FileActionOptions,
77
formatFileSize,
8+
getVaultClaim,
89
isLocationCommonActive,
910
isLocationPublicActive,
1011
isLocationSharesActive,
1112
isLocationSpacesActive,
1213
useArchiverService,
1314
useAuthStore,
15+
useExtensionRegistry,
1416
useIsFilesAppActive,
1517
useMessages,
1618
useRouter
@@ -23,6 +25,7 @@ export const useFileActionsDownloadArchive = () => {
2325
const { $ngettext, $gettext, current } = useGettext()
2426
const authStore = useAuthStore()
2527
const isFilesAppActive = useIsFilesAppActive()
28+
const extensionRegistry = useExtensionRegistry()
2629

2730
const handler = ({ space, resources }: FileActionOptions) => {
2831
if (resources.length > 1) {
@@ -84,7 +87,7 @@ export const useFileActionsDownloadArchive = () => {
8487
: ''
8588
},
8689
isDisabled: ({ resources }) => areArchiverLimitsExceeded(resources),
87-
isVisible: ({ resources }) => {
90+
isVisible: ({ space, resources }) => {
8891
if (
8992
unref(isFilesAppActive) &&
9093
!isLocationSpacesActive(router, 'files-spaces-generic') &&
@@ -108,7 +111,13 @@ export const useFileActionsDownloadArchive = () => {
108111
// The archive is zipped server-side from the raw (ciphertext) blobs
109112
// under their encrypted names - we can't decrypt that client-side,
110113
// so hide archive download whenever a vault resource is involved.
111-
if (resources.some((r) => r.isInVault)) {
114+
// A vault root however can be downloaded (with encrypted contents).
115+
if (
116+
resources.some((r) => {
117+
const claim = getVaultClaim(extensionRegistry, space, r.path)
118+
return r.isInVault && claim?.vaultRoot !== r.path
119+
})
120+
) {
112121
return false
113122
}
114123
if (resources.length === 1 && !resources[0].isFolder) {

0 commit comments

Comments
 (0)