Skip to content
Snippets Groups Projects

Download work around

2 files
+ 9
7
Compare changes
  • Side-by-side
  • Inline

Files

@@ -122,16 +122,16 @@ public class FileService {
* @throws Exception if the file cannot be found (this should not happen)
*/
public Resource downloadFiles(Long entityId, String directory) throws IOException {
String zipName = directory + "_" + entityId + ".zip";
String zipName = "_" + entityId + ".zip";
Path path = Paths
.get("./" + directory + File.separator + StringUtils.cleanPath(getDirectory(entityId)));
.get(directory + File.separator + StringUtils.cleanPath(getDirectory(entityId)));
File dir = new File(String.valueOf(path));
File zipDir = new File("./zips");
File zipDir = new File("/tmp/zips/" + directory);
zipDir.mkdirs();
FileOutputStream stream = new FileOutputStream("./zips/" + zipName);
FileOutputStream stream = new FileOutputStream("/tmp/zips/" + directory + File.separator + zipName);
ZipOutputStream zipFile = new ZipOutputStream(stream);
for (File f : dir.listFiles()) {
FileInputStream fis = new FileInputStream(f);
@@ -148,7 +148,7 @@ public class FileService {
zipFile.close();
stream.close();
return new UrlResource("file:./zips/" + zipName);
return new UrlResource("file:///tmp/zips/" + zipName);
}
Loading