Skip to content

Commit d34e8d0

Browse files
datvong-wmitoys
authored andcommitted
For identity Accept-Encoding (microsoft#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

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎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)