Skip to content

Commit 8ee728e

Browse files
committed
undo these changes that were carried over from outdated master
1 parent 3e3d36e commit 8ee728e

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)