Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit d34e8d0

Browse files
datvong-wmitoys
authored andcommitted
For identity Accept-Encoding (#1237)
If the server returns gzip encoding, the size check will fail because getContentLength() could potentially return -1 for gzipped content.
1 parent ab9d27d commit d34e8d0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ public void downloadPackage(JSONObject updatePackage, String expectedBundleFileN
163163
try {
164164
URL downloadUrl = new URL(downloadUrlString);
165165
connection = (HttpURLConnection) (downloadUrl.openConnection());
166+
connection.setRequestProperty("Accept-Encoding", "identity");
166167
bin = new BufferedInputStream(connection.getInputStream());
167168

168169
long totalBytes = connection.getContentLength();
@@ -365,4 +366,4 @@ public void downloadAndReplaceCurrentBundle(String remoteBundleUrl, String bundl
365366
public void clearUpdates() {
366367
FileUtils.deleteDirectoryAtPath(getCodePushPath());
367368
}
368-
}
369+
}

0 commit comments

Comments
 (0)