diff --git a/library/src/main/java/com/liulishuo/filedownloader/util/FileDownloadUtils.java b/library/src/main/java/com/liulishuo/filedownloader/util/FileDownloadUtils.java index 9cc88193..97703478 100644 --- a/library/src/main/java/com/liulishuo/filedownloader/util/FileDownloadUtils.java +++ b/library/src/main/java/com/liulishuo/filedownloader/util/FileDownloadUtils.java @@ -578,6 +578,7 @@ public static long findInstanceLengthFromContentRange(FileDownloadConnection con public static long findContentLength(final int id, FileDownloadConnection connection) { long contentLength = FileDownloadUtils .convertContentLengthString(connection.getResponseHeaderField("Content-Length")); + if (contentLength < 0) contentLength = findInstanceLengthFromContentRange(connection); final String transferEncoding = connection.getResponseHeaderField("Transfer-Encoding"); if (contentLength < 0) {