From 2343e739d10febb3d65dfa207c2b9a11e8ac5859 Mon Sep 17 00:00:00 2001 From: CalDescent Date: Fri, 11 Feb 2022 14:35:46 +0000 Subject: [PATCH] Handle case where a file cannot be unzipped. --- .../java/org/qortal/arbitrary/ArbitraryDataReader.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/qortal/arbitrary/ArbitraryDataReader.java b/src/main/java/org/qortal/arbitrary/ArbitraryDataReader.java index bb5641c2..3a3f84eb 100644 --- a/src/main/java/org/qortal/arbitrary/ArbitraryDataReader.java +++ b/src/main/java/org/qortal/arbitrary/ArbitraryDataReader.java @@ -468,12 +468,18 @@ public class ArbitraryDataReader { throw new DataException(String.format("Unable to unzip file: %s", e.getMessage())); } - // Replace filePath pointer with the uncompressed file path + if (!this.uncompressedPath.toFile().exists()) { + throw new DataException(String.format("Unable to unzip file: %s", this.filePath)); + } + + // Delete original compressed file if (FilesystemUtils.pathInsideDataOrTempPath(this.filePath)) { if (Files.exists(this.filePath)) { Files.delete(this.filePath); } } + + // Replace filePath pointer with the uncompressed file path this.filePath = this.uncompressedPath; }