Skip to content

Commit

Permalink
Added null and path key check on addCompleteDownload method
Browse files Browse the repository at this point in the history
  • Loading branch information
adamburnett committed Jul 17, 2018
1 parent fb0c5f1 commit 4f66c84
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions android/src/main/java/com/RNFetchBlob/RNFetchBlob.java
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ public void getContentIntent(String mime, Promise promise) {
@ReactMethod
public void addCompleteDownload (ReadableMap config, Promise promise) {
DownloadManager dm = (DownloadManager) RCTContext.getSystemService(RCTContext.DOWNLOAD_SERVICE);
if (config == null || !config.hasKey("path"))
{
promise.reject("EINVAL", "RNFetchblob.addCompleteDownload config or path missing.");
return;
}
String path = RNFetchBlobFS.normalizePath(config.getString("path"));
if(path == null) {
promise.reject("EINVAL", "RNFetchblob.addCompleteDownload can not resolve URI:" + config.getString("path"));
Expand Down

0 comments on commit 4f66c84

Please sign in to comment.