You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue:
I keep getting the error from rn-fetch-blob: "RNFetchBlob failed. Download interrupted."
What:
I am trying to download a PDF that is sent from the server with Transfer-Encoding: chunked. Here is the response headers from curl (curl used to verify headers):
Inside rn-fetch-blob source code I see the following (RNFetchBlobReq.java):
case FileStorage:
ResponseBody responseBody = resp.body();
try {
// In order to write response data to `destPath` we have to invoke this method.
// It uses customized response body which is able to report download progress
// and write response data to destination path.
responseBody.bytes();
} catch (Exception ignored) {
ignored.printStackTrace();
}
RNFetchBlobFileResp rnFetchBlobFileResp = (RNFetchBlobFileResp) responseBody;
if(rnFetchBlobFileResp != null && rnFetchBlobFileResp.isDownloadComplete() == false){
callback.invoke("RNFetchBlob failed. Download interrupted.", null);
}
else {
this.destPath = this.destPath.replace("?append=true", "");
callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_PATH, this.destPath);
}
break;
The rnFetchBlobFileResp.isDownloadComplete() is where it is failing. Inside that method we have (RNFetchBlobFileResp.java):
public boolean isDownloadComplete() {
return bytesDownloaded == contentLength();
}
And contentLength() we have (RNFetchBlobBody.java):
@Override
public long contentLength() {
return chunkedEncoding ? -1 : contentLength;
}
So unless I am reading this wrong, the contentLength for "chunked" encoding will always be -1, which will never match bytesDownloaded?
Am I reading this correctly? Doesn't this mean Transfer-Encoding: chunked downloads will always fail?
The text was updated successfully, but these errors were encountered:
Info:
rn-fetch-blob: 0.11.1
react-native: 0.61.1
platform: Android
Issue:
I keep getting the error from
rn-fetch-blob
: "RNFetchBlob failed. Download interrupted."What:
I am trying to download a PDF that is sent from the server with
Transfer-Encoding: chunked
. Here is the response headers fromcurl
(curl
used to verify headers):Inside
rn-fetch-blob
source code I see the following (RNFetchBlobReq.java
):The
rnFetchBlobFileResp.isDownloadComplete()
is where it is failing. Inside that method we have (RNFetchBlobFileResp.java
):And
contentLength()
we have (RNFetchBlobBody.java
):So unless I am reading this wrong, the
contentLength
for "chunked" encoding will always be-1
, which will never matchbytesDownloaded
?Am I reading this correctly? Doesn't this mean
Transfer-Encoding: chunked
downloads will always fail?The text was updated successfully, but these errors were encountered: