File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
android/src/main/java/com/RNFetchBlob Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -578,16 +578,27 @@ private void done(Response resp) {
578578 }
579579 break ;
580580 case FileStorage :
581+ ResponseBody responseBody = resp .body ();
582+
581583 try {
582584 // In order to write response data to `destPath` we have to invoke this method.
583585 // It uses customized response body which is able to report download progress
584586 // and write response data to destination path.
585- resp . body () .bytes ();
587+ responseBody .bytes ();
586588 } catch (Exception ignored ) {
587589// ignored.printStackTrace();
588590 }
589- this .destPath = this .destPath .replace ("?append=true" , "" );
590- callback .invoke (null , RNFetchBlobConst .RNFB_RESPONSE_PATH , this .destPath );
591+
592+ RNFetchBlobFileResp rnFetchBlobFileResp = (RNFetchBlobFileResp ) responseBody ;
593+
594+ if (rnFetchBlobFileResp != null && !rnFetchBlobFileResp .isDownloadComplete ()){
595+ callback .invoke ("RNFetchBlob failed. Download interrupted." , null );
596+ }
597+ else {
598+ this .destPath = this .destPath .replace ("?append=true" , "" );
599+ callback .invoke (null , RNFetchBlobConst .RNFB_RESPONSE_PATH , this .destPath );
600+ }
601+
591602 break ;
592603 default :
593604 try {
You can’t perform that action at this time.
0 commit comments