Skip to content

Commit cd440ff

Browse files
authored
Do not fail download if content length is unknown (#977)
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 3.
1 parent 17ac315 commit cd440ff

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
@@ -426,7 +426,7 @@ private static boolean downloadFile(URLConnection con, File output) throws IOExc
426426
read = IOUtils.copy(stream, out);
427427
}
428428

429-
if (read != len) {
429+
if (len != -1 && read != len) {
430430
output.delete();
431431
throw new IOException("Failed to read all of data from " + con.getURL() + " got " + read + " expected " + len);
432432
}

0 commit comments

Comments
 (0)