Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit 7a11f80

Browse files
committed
Fix Android request cancellation issue when path or fileCache is set #268
1 parent dd4dbb2 commit 7a11f80

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
@@ -506,7 +506,14 @@ private void done(Response resp) {
506506
// ignored.printStackTrace();
507507
}
508508
this.destPath = this.destPath.replace("?append=true", "");
509-
callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_PATH, this.destPath);
509+
// #268 `then` block invoked when cancal the task
510+
if(!taskTable.containsKey(this.taskId)) {
511+
callback.invoke("Canceled", RNFetchBlobConst.RNFB_RESPONSE_PATH, this.destPath);
512+
}
513+
else {
514+
callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_PATH, this.destPath);
515+
}
516+
510517
break;
511518
default:
512519
try {

0 commit comments

Comments
 (0)