Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 1f84a51

Browse files
wkh237campsafari
authored andcommitted
Fix Android request cancellation issue when path or fileCache is set wkh237#268
1 parent dd5e1ea commit 1f84a51

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,14 @@ private void done(Response resp) {
515515
// ignored.printStackTrace();
516516
}
517517
this.destPath = this.destPath.replace("?append=true", "");
518-
callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_PATH, this.destPath);
518+
// #268 `then` block invoked when cancal the task
519+
if(!taskTable.containsKey(this.taskId)) {
520+
callback.invoke("Canceled", RNFetchBlobConst.RNFB_RESPONSE_PATH, this.destPath);
521+
}
522+
else {
523+
callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_PATH, this.destPath);
524+
}
525+
519526
break;
520527
default:
521528
try {

0 commit comments

Comments
 (0)