-
Bug
-
Resolution: Done
-
Medium
-
None
Downloading certain books (e.g. "A Glass Half Full" by Sanjay Kathuria in NYU Library) results in the error "Output file size [bytes] must match expected size -1". This happens when the download response is chunked, and does not have a Content-length header.
The problem is that LSHTTPDownload attempts to verify the file size if the expected size is not null:
But if the content length is unknown, the expected size can be set to -1 instead of null:
- https://github.com/NYPL-Simplified/Simplified-Android-HTTP/blob/2f905c473f3c0b9707c09adf74fe21bafeebb3de/org.librarysimplified.http.vanilla/src/main/java/org/librarysimplified/http/vanilla/internal/LSHTTPResponse.kt#L40-L41
- https://square.github.io/okhttp/4.x/okhttp/okhttp3/-response-body/content-length/