Skip to content

Commit 4fb4ff4

Browse files
authored
Do not fail download if content length is unknown (#978)
Fixes ForgeGradle crashing with cryptic `Cannot resolve external dependency net.minecraftforge:accesstransformers:1.0.+` errors. The real exception was suppressed. Partial backport of #905 to ForgeGradle 4.
1 parent 22600d4 commit 4fb4ff4

File tree

1 file changed

+1
-1
lines changed
  • src/common/java/net/minecraftforge/gradle/common/util

1 file changed

+1
-1
lines changed

src/common/java/net/minecraftforge/gradle/common/util/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ private static boolean downloadFile(URLConnection con, File output) throws IOExc
441441
read = IOUtils.copy(stream, out);
442442
}
443443

444-
if (read != len) {
444+
if (len != -1 && read != len) {
445445
output.delete();
446446
throw new IOException("Failed to read all of data from " + con.getURL() + " got " + read + " expected " + len);
447447
}

0 commit comments

Comments
 (0)