Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
Backport fix to #402
Browse files Browse the repository at this point in the history
  • Loading branch information
Earthcomputer committed Jun 30, 2022
1 parent 1329841 commit 59abb00
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
Expand All @@ -24,6 +25,7 @@
import java.util.function.BiConsumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;

public class AssetDownloader {

Expand Down Expand Up @@ -320,7 +322,11 @@ private static File download(URL url, String dest, boolean force) {

destFile.getParentFile().mkdirs();
try {
FileUtils.copyInputStreamToFile(connection.getInputStream(), destFile);
InputStream stream = connection.getInputStream();
if ("gzip".equals(connection.getContentEncoding())) {
stream = new GZIPInputStream(stream);
}
FileUtils.copyInputStreamToFile(stream, destFile);
} catch (IOException e) {
destFile.delete();
throw e;
Expand Down

0 comments on commit 59abb00

Please sign in to comment.