Use system temp directory instead of making a "temp" subfolder when zipping files.

This commit is contained in:
CalDescent 2021-06-26 10:11:34 +01:00
parent fe7c40cb7c
commit 47c70eea9e

View File

@ -136,15 +136,16 @@ public class WebsiteResource {
}
// Ensure temp folder exists
java.nio.file.Path tempDir = null;
try {
Files.createDirectories(Paths.get("temp"));
tempDir = Files.createTempDirectory("qortal-zip");
} catch (IOException e) {
LOGGER.error("Unable to create temp directory");
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.REPOSITORY_ISSUE);
}
// Firstly zip up the directory
String outputFilePath = "temp/zipped.zip";
String outputFilePath = tempDir.toString() + File.separator + "zipped.zip";
try {
ZipUtils.zip(directoryPath, outputFilePath, "data");
} catch (IOException e) {