mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 05:27:43 -05:00
Fix issue caused in previous commit.
This commit is contained in:
@@ -161,6 +161,12 @@ public class Download {
|
||||
eTag = readEtag(output);
|
||||
}
|
||||
|
||||
try {
|
||||
createParentDirs(output.toFile());
|
||||
} catch (IOException e) {
|
||||
throw error(e, "Failed to create parent directories");
|
||||
}
|
||||
|
||||
final HttpRequest httpRequest = eTag
|
||||
.map(this::getETagRequest)
|
||||
.orElseGet(this::getRequest);
|
||||
@@ -180,10 +186,9 @@ public class Download {
|
||||
|
||||
if (success) {
|
||||
try {
|
||||
createParentDirs(output.toFile());
|
||||
Files.deleteIfExists(output);
|
||||
} catch (IOException e) {
|
||||
throw error(e, "Failed to prepare path for download");
|
||||
throw error(e, "Failed to delete existing file");
|
||||
}
|
||||
|
||||
final long length = Long.parseLong(response.headers().firstValue("Content-Length").orElse("-1"));
|
||||
|
||||
@@ -60,7 +60,7 @@ class DownloadFileTest extends DownloadTest {
|
||||
it.result("Hello World")
|
||||
}
|
||||
|
||||
def output = new File(File.createTempDir(), "file.txt").toPath()
|
||||
def output = new File(File.createTempDir(), "subdir/file.txt").toPath()
|
||||
|
||||
when:
|
||||
def result = Download.create("$PATH/simpleFile").downloadPath(output)
|
||||
|
||||
Reference in New Issue
Block a user