16
16
import org .springframework .beans .factory .annotation .Autowired ;
17
17
import org .springframework .stereotype .Controller ;
18
18
import org .springframework .ui .ModelMap ;
19
+ import org .springframework .util .CollectionUtils ;
19
20
import org .springframework .util .StringUtils ;
20
21
import org .springframework .web .bind .annotation .ExceptionHandler ;
21
22
import org .springframework .web .bind .annotation .RequestMapping ;
@@ -108,7 +109,7 @@ public void download(@RequestParam("file") String filePath, ModelMap model, Http
108
109
}
109
110
110
111
@ RequestMapping (value = {"/zip" }, method ={RequestMethod .GET , RequestMethod .POST })
111
- public void downloadAsZip (@ RequestParam ("selectedFile" ) List <String > filePaths , ModelMap model , HttpServletRequest request ,
112
+ public void downloadAsZip (@ RequestParam (name = "selectedFile" , required = false ) List <String > filePaths , ModelMap model , HttpServletRequest request ,
112
113
HttpServletResponse response ) throws IOException , DownloadNotAllowedException , GenericFilebrowserException {
113
114
if (!filebrowserConfig .isEnabled ()) {
114
115
return ;
@@ -126,9 +127,10 @@ public void downloadAsZip(@RequestParam("selectedFile") List<String> filePaths,
126
127
}
127
128
});
128
129
}
129
-
130
- if (LOGGER .isTraceEnabled ()) LOGGER .trace ("downloadAsZip file: " + decodedPaths .size ());
131
- filebrowserService .downloadFilesAsZip (decodedPaths , response );
130
+ if (!CollectionUtils .isEmpty (decodedPaths )) {
131
+ if (LOGGER .isTraceEnabled ()) LOGGER .trace ("downloadAsZip file: " + decodedPaths .size ());
132
+ filebrowserService .downloadFilesAsZip (decodedPaths , response );
133
+ }
132
134
}
133
135
134
136
@ RequestMapping (value = {"/upload" }, method ={RequestMethod .POST })
0 commit comments