Skip to content

Commit d39cdaf

Browse files
committed
feat: handle hide-download DAV property
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 5b19bd3 commit d39cdaf

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/files_actions/viewerAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async function execAction(node: Node, view: View, dir: string): Promise<boolean|
5454
onNext(fileInfo) {
5555
pushToHistory(fileInfo, view, dir)
5656
},
57-
onClose
57+
onClose,
5858
})
5959

6060
return null

src/utils/canDownload.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import type { FileInfo } from './fileUtils'
1010
* @param fileInfo The file info to check
1111
*/
1212
export function canDownload(fileInfo: FileInfo) {
13+
if (fileInfo.hideDownload) {
14+
return false
15+
}
16+
1317
// TODO: This should probably be part of `@nextcloud/sharing`
1418
// check share attributes
1519
const shareAttributes = typeof fileInfo?.shareAttributes === 'string' ? JSON.parse(fileInfo.shareAttributes || '[]') : fileInfo?.shareAttributes

src/utils/fileUtils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ export interface FileInfo {
3434
type: 'directory'|'file'
3535
/** Attributes for file shares */
3636
shareAttributes?: string|Array<{value:boolean|string|number|null|object|Array<unknown>, key: string, scope: string}>
37+
/** Share hidden state since Nextcloud 31 */
38+
hideDownload?: boolean
3739

3840
// custom attributes not fetch from API
3941

0 commit comments

Comments
 (0)