|
@@ -548,6 +548,7 @@ class RNFetchBlobFS {
|
548
|
548
|
path = normalizePath(path);
|
549
|
549
|
InputStream in = null;
|
550
|
550
|
OutputStream out = null;
|
|
551
|
+ String message = "";
|
551
|
552
|
|
552
|
553
|
try {
|
553
|
554
|
if(!isPathExists(path)) {
|
|
@@ -571,7 +572,7 @@ class RNFetchBlobFS {
|
571
|
572
|
out.write(buf, 0, len);
|
572
|
573
|
}
|
573
|
574
|
} catch (Exception err) {
|
574
|
|
- callback.invoke(err.getLocalizedMessage());
|
|
575
|
+ message += err.getLocalizedMessage();
|
575
|
576
|
} finally {
|
576
|
577
|
try {
|
577
|
578
|
if (in != null) {
|
|
@@ -580,11 +581,17 @@ class RNFetchBlobFS {
|
580
|
581
|
if (out != null) {
|
581
|
582
|
out.close();
|
582
|
583
|
}
|
583
|
|
- callback.invoke();
|
584
|
584
|
} catch (Exception e) {
|
585
|
|
- callback.invoke(e.getLocalizedMessage());
|
|
585
|
+ message += e.getLocalizedMessage();
|
586
|
586
|
}
|
587
|
587
|
}
|
|
588
|
+ // Only call the callback once to prevent the app from crashing
|
|
589
|
+ // with an 'Illegal callback invocation from native module' exception.
|
|
590
|
+ if (message != "") {
|
|
591
|
+ callback.invoke(message);
|
|
592
|
+ } else {
|
|
593
|
+ callback.invoke();
|
|
594
|
+ }
|
588
|
595
|
}
|
589
|
596
|
|
590
|
597
|
/**
|