File tree Expand file tree Collapse file tree 4 files changed +34
-27
lines changed
Expand file tree Collapse file tree 4 files changed +34
-27
lines changed Original file line number Diff line number Diff line change 380380 }
381381 } ;
382382
383- OCA . Files . Download . get ( files , dir , randomToken ) ;
383+ OCA . Files . download ( files , dir , randomToken ) ;
384384 OC . Util . waitFor ( checkForDownloadCookie , 500 ) ;
385385 }
386386 } ;
Original file line number Diff line number Diff line change 2020 *
2121 */
2222
23- import Download from './services/Download'
23+ import download from './services/Download'
2424
25- // Init Sidebar Service
2625if ( ! window . OCA . Files ) {
2726 window . OCA . Files = { }
2827}
29- Object . assign ( window . OCA . Files , { Download : new Download ( ) } )
28+ Object . assign ( window . OCA . Files , { download } )
Original file line number Diff line number Diff line change 2323import { generateUrl } from '@nextcloud/router'
2424import axios from '@nextcloud/axios'
2525
26- export default class Download {
27-
28- export
29- const
30- get ( files , dir , downloadStartSecret ) {
31- axios . post (
32- generateUrl ( 'apps/files/registerDownload' ) ,
33- {
34- files,
35- dir,
36- downloadStartSecret,
37- }
38- ) . then ( res => {
39- if ( res . status === 200 && res . data . token ) {
40- const dlUrl = generateUrl (
41- 'apps/files/ajax/download.php?token={token}' ,
42- { token : res . data . token }
43- )
44- OC . redirect ( dlUrl )
45- }
46- } )
47- }
48-
26+ export default function ( files , dir , downloadStartSecret ) {
27+ axios . post (
28+ generateUrl ( 'apps/files/registerDownload' ) ,
29+ {
30+ files,
31+ dir,
32+ downloadStartSecret,
33+ }
34+ ) . then ( res => {
35+ if ( res . status === 200 && res . data . token ) {
36+ const dlUrl = generateUrl (
37+ 'apps/files/ajax/download.php?token={token}' ,
38+ { token : res . data . token }
39+ )
40+ OC . redirect ( dlUrl )
41+ }
42+ } )
4943}
Original file line number Diff line number Diff line change @@ -295,6 +295,20 @@ OCA.Sharing.PublicApp = {
295295 $ ( '#download' ) . click ( function ( e ) {
296296 e . preventDefault ( ) ;
297297 OC . redirect ( FileList . getDownloadUrl ( ) ) ;
298+
299+ var path = dir || this . getCurrentDirectory ( ) ;
300+ if ( _ . isArray ( filename ) ) {
301+ filename = JSON . stringify ( filename ) ;
302+ }
303+ var params = {
304+ path : path
305+ } ;
306+ if ( filename ) {
307+ params . files = filename ;
308+ }
309+
310+
311+ OCA . Files . Download . get ( )
298312 } ) ;
299313
300314 if ( hideDownload === 'true' ) {
You can’t perform that action at this time.
0 commit comments