Browse Source

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

qdn
CalDescent 3 years ago
parent
commit
47c70eea9e
  1. 5
      src/main/java/org/qortal/api/resource/WebsiteResource.java

5
src/main/java/org/qortal/api/resource/WebsiteResource.java

@ -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) {

Loading…
Cancel
Save