Source:
public void compressSelectedResources(String siteId, String siteTitle, List<String> selectedFolderIds, List<String> selectedFiles, HttpServletResponse response) { Map<String, ContentResource> resourcesToZip = new HashMap<>(); try { if (selectedFolderIds.size() > 0) { for (String selectedFolder : selectedFolderIds) { List<ContentResource> folderContents = ContentHostingService.getAllResources(selectedFolder); for (ContentResource folderFile : folderContents) { resourcesToZip.put(folderFile.getId(), folderFile); } } } for (String selectedFile : selectedFiles) { ContentResource contentFile = ContentHostingService.getResource(selectedFile); resourcesToZip.put(contentFile.getId(), contentFile); } } catch (IdUnusedException | PermissionException | TypeException e) { LOG.error(e.getMessage(), e); } try (OutputStream zipOut = response.getOutputStream(); ZipOutputStream out = new ZipOutputStream(zipOut)) { if (!resourcesToZip.isEmpty()) { String firstContentResourceId = resourcesToZip.entrySet().iterator().next().getKey(); if (ContentHostingService.isInDropbox(firstContentResourceId) && ServerConfigurationService.getBoolean("dropbox.zip.haveDisplayname", true)) { response.setHeader("Content-disposition", "inline; filename=" + siteId + "DropBox.zip"); } else { response.setHeader("Content-disposition", "inline; filename=" + siteTitle + ".zip"); } } else { response.setHeader("Content-disposition", "inline; filename=" + siteTitle + ".zip"); } response.setContentType("application/zip"); for (ContentResource contentResource : resourcesToZip.values()) { int siteIdPosition = contentResource.getId().indexOf(siteId); String rootId = contentResource.getId().substring(0, siteIdPosition) + siteId + "/"; storeContentResource(rootId, contentResource, out); } } catch (IOException ioe) { LOG.error(ioe.getMessage(), ioe); } catch (Exception e) { LOG.error(e.getMessage(), e); } }

Target:
public void compressSelectedResources(String siteId, String siteTitle, List<String> selectedFolderIds, List<String> selectedFiles, HttpServletResponse response) { Map<String, ContentResource> resourcesToZip = new HashMap<>(); try { if (selectedFolderIds.size() > 0) { for (String selectedFolder : selectedFolderIds) { List<ContentResource> folderContents = ContentHostingService.getAllResources(selectedFolder); for (ContentResource folderFile : folderContents) { resourcesToZip.put(folderFile.getId(), folderFile); } } } for (String selectedFile : selectedFiles) { ContentResource contentFile = ContentHostingService.getResource(selectedFile); resourcesToZip.put(contentFile.getId(), contentFile); } } catch (IdUnusedException | PermissionException | TypeException e) { LOG.error(e.getMessage(), e); } try (OutputStream zipOut = response.getOutputStream(); ZipOutputStream out = new ZipOutputStream(zipOut)) { if (!resourcesToZip.isEmpty()) { String firstContentResourceId = resourcesToZip.entrySet().iterator().next().getKey(); if (ContentHostingService.isInDropbox(firstContentResourceId) && ServerConfigurationService.getBoolean("dropbox.zip.haveDisplayname", true)) { response.setHeader("Content-disposition", "attachment; filename=" + siteId + "DropBox.zip"); } else { response.setHeader("Content-disposition", "attachment; filename=" + siteTitle + ".zip"); } } else { response.setHeader("Content-disposition", "attachment; filename=" + siteTitle + ".zip"); } response.setContentType("application/zip"); for (ContentResource contentResource : resourcesToZip.values()) { int siteIdPosition = contentResource.getId().indexOf(siteId); String rootId = contentResource.getId().substring(0, siteIdPosition) + siteId + "/"; storeContentResource(rootId, contentResource, out); } } catch (IOException ioe) { LOG.error(ioe.getMessage(), ioe); } catch (Exception e) { LOG.error(e.getMessage(), e); } }