mirror of
https://github.com/apache/cordova-plugin-file-transfer.git
synced 2026-02-02 00:00:05 +08:00
CB-5762 android: Fix lengthComputable set wrong for gzip downloads
Gzip + no Content-Length header should be lengthComputable=false
This commit is contained in:
@@ -760,8 +760,10 @@ public class FileTransfer extends CordovaPlugin {
|
||||
if (connection.getContentEncoding() == null || connection.getContentEncoding().equalsIgnoreCase("gzip")) {
|
||||
// Only trust content-length header if we understand
|
||||
// the encoding -- identity or gzip
|
||||
progress.setLengthComputable(true);
|
||||
progress.setTotal(connection.getContentLength());
|
||||
if (connection.getContentLength() != -1) {
|
||||
progress.setLengthComputable(true);
|
||||
progress.setTotal(connection.getContentLength());
|
||||
}
|
||||
}
|
||||
inputStream = getInputStream(connection);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user