File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,19 +41,20 @@ const downloadNodes = function(dir: string, nodes: Node[]) {
4141 triggerDownload ( url )
4242}
4343
44- // If the mount type is a share, ensure it got download permissions.
4544const isDownloadable = function ( node : Node ) {
46- if ( node . attributes [ 'mount-type' ] !== 'shared' ) {
47- return true
45+ if ( ( node . permissions & Permission . READ ) === 0 ) {
46+ return false
4847 }
4948
50- const downloadAttribute = JSON . parse ( node . attributes [ 'share-attributes' ] ) . find ( attribute => attribute . scope === 'permissions' && attribute . key === 'download' )
51-
52- if ( downloadAttribute === undefined ) {
53- return true
49+ // If the mount type is a share, ensure it got download permissions.
50+ if ( node . attributes [ 'mount-type' ] === 'shared' ) {
51+ const downloadAttribute = JSON . parse ( node . attributes [ 'share-attributes' ] ) . find ( ( attribute : { scope : string ; key : string } ) => attribute . scope === 'permissions' && attribute . key === 'download' )
52+ if ( downloadAttribute !== undefined && downloadAttribute . enabled === false ) {
53+ return false
54+ }
5455 }
5556
56- return downloadAttribute . enable
57+ return true
5758}
5859
5960export const action = new FileAction ( {
@@ -74,8 +75,7 @@ export const action = new FileAction({
7475 return false
7576 }
7677
77- return nodes
78- . every ( node => ( ( node . permissions & Permission . READ ) !== 0 ) && isDownloadable ( node ) )
78+ return nodes . every ( isDownloadable )
7979 } ,
8080
8181 async exec ( node : Node , view : View , dir : string ) {
You can’t perform that action at this time.
0 commit comments