Skip to content

Commit a451345

Browse files
committed
Fix #35 - sorting of root paths and file list should be initially by name in natural order
1 parent e67ea27 commit a451345

File tree

4 files changed

+707
-672
lines changed

4 files changed

+707
-672
lines changed

admin-tools-filebrowser/src/main/java/de/chandre/admintool/filebrowser/AdminToolFilebrowserController.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.springframework.beans.factory.annotation.Autowired;
1717
import org.springframework.stereotype.Controller;
1818
import org.springframework.ui.ModelMap;
19+
import org.springframework.util.CollectionUtils;
1920
import org.springframework.util.StringUtils;
2021
import org.springframework.web.bind.annotation.ExceptionHandler;
2122
import org.springframework.web.bind.annotation.RequestMapping;
@@ -108,7 +109,7 @@ public void download(@RequestParam("file") String filePath, ModelMap model, Http
108109
}
109110

110111
@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,
112113
HttpServletResponse response) throws IOException, DownloadNotAllowedException, GenericFilebrowserException {
113114
if (!filebrowserConfig.isEnabled()) {
114115
return;
@@ -126,9 +127,10 @@ public void downloadAsZip(@RequestParam("selectedFile") List<String> filePaths,
126127
}
127128
});
128129
}
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+
}
132134
}
133135

134136
@RequestMapping(value = {"/upload"}, method={RequestMethod.POST})

0 commit comments

Comments
 (0)