|
@@ -531,16 +531,26 @@ public class RNFetchBlobReq extends BroadcastReceiver implements Runnable {
|
531
|
531
|
}
|
532
|
532
|
break;
|
533
|
533
|
case FileStorage:
|
|
534
|
+ ResponseBody responseBody = resp.body();
|
|
535
|
+
|
534
|
536
|
try {
|
535
|
537
|
// In order to write response data to `destPath` we have to invoke this method.
|
536
|
538
|
// It uses customized response body which is able to report download progress
|
537
|
539
|
// and write response data to destination path.
|
538
|
|
- resp.body().bytes();
|
|
540
|
+ responseBody.bytes();
|
539
|
541
|
} catch (Exception ignored) {
|
540
|
542
|
// ignored.printStackTrace();
|
541
|
543
|
}
|
542
|
|
- this.destPath = this.destPath.replace("?append=true", "");
|
543
|
|
- callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_PATH, this.destPath);
|
|
544
|
+
|
|
545
|
+ RNFetchBlobFileResp rnFetchBlobFileResp = (RNFetchBlobFileResp) responseBody;
|
|
546
|
+
|
|
547
|
+ if(rnFetchBlobFileResp != null && rnFetchBlobFileResp.isDownloadComplete() == false){
|
|
548
|
+ callback.invoke("RNFetchBlob failed. Download interrupted.", null);
|
|
549
|
+ }
|
|
550
|
+ else {
|
|
551
|
+ this.destPath = this.destPath.replace("?append=true", "");
|
|
552
|
+ callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_PATH, this.destPath);
|
|
553
|
+ }
|
544
|
554
|
break;
|
545
|
555
|
default:
|
546
|
556
|
try {
|