mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Merge remote-tracking branch 'FabricMC/dev/0.6' into dev/0.6-forge
# Conflicts: # build.gradle
This commit is contained in:
@@ -26,9 +26,11 @@ package net.fabricmc.loom.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
@@ -109,7 +111,13 @@ public class DownloadUtil {
|
||||
}
|
||||
|
||||
try { // Try download to the output
|
||||
FileUtils.copyInputStreamToFile(connection.getInputStream(), to);
|
||||
InputStream inputStream = connection.getInputStream();
|
||||
|
||||
if ("gzip".equals(connection.getContentEncoding())) {
|
||||
inputStream = new GZIPInputStream(inputStream);
|
||||
}
|
||||
|
||||
FileUtils.copyInputStreamToFile(inputStream, to);
|
||||
} catch (IOException e) {
|
||||
to.delete(); // Probably isn't good if it fails to copy/save
|
||||
throw e;
|
||||
|
||||
@@ -26,9 +26,11 @@ package net.fabricmc.loom.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -99,7 +101,13 @@ public class HashedDownloadUtil {
|
||||
}
|
||||
|
||||
try { // Try download to the output
|
||||
FileUtils.copyInputStreamToFile(connection.getInputStream(), to);
|
||||
InputStream inputStream = connection.getInputStream();
|
||||
|
||||
if ("gzip".equals(connection.getContentEncoding())) {
|
||||
inputStream = new GZIPInputStream(inputStream);
|
||||
}
|
||||
|
||||
FileUtils.copyInputStreamToFile(inputStream, to);
|
||||
} catch (IOException e) {
|
||||
delete(to); // Probably isn't good if it fails to copy/save
|
||||
throw e;
|
||||
|
||||
Reference in New Issue
Block a user