Skip to content
This repository was archived by the owner on May 18, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.Toast;

import com.facebook.react.views.scroll.ScrollEvent;
import com.facebook.react.views.scroll.ScrollEventType;
Expand Down Expand Up @@ -201,7 +202,13 @@ public void onDownloadStart(String url, String userAgent, String contentDisposit

RNCWebViewModule module = getModule(reactContext);

DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
DownloadManager.Request request;
try {
request = new DownloadManager.Request(Uri.parse(url));
} catch (IllegalArgumentException e) {
Toast.makeText(webView.getContext(),"Something went wrong",Toast.LENGTH_SHORT).show();
return;
}

String fileName = URLUtil.guessFileName(url, contentDisposition, mimetype);
String downloadMessage = "Downloading " + fileName;
Expand Down