|
@@ -7,7 +7,6 @@ import com.facebook.react.uimanager.UIManagerModule;
|
7
|
7
|
|
8
|
8
|
import java.net.MalformedURLException;
|
9
|
9
|
import java.net.URL;
|
10
|
|
-import java.net.URLDecoder;
|
11
|
10
|
import java.util.LinkedList;
|
12
|
11
|
import java.util.List;
|
13
|
12
|
import java.util.regex.Pattern;
|
|
@@ -480,16 +479,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
480
|
479
|
|
481
|
480
|
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
|
482
|
481
|
|
483
|
|
- //Try to extract filename from contentDisposition, otherwise guess using URLUtil
|
484
|
|
- String fileName = "";
|
485
|
|
- try {
|
486
|
|
- fileName = contentDisposition.replaceFirst("(?i)^.*filename=\"?([^\"]+)\"?.*$", "$1");
|
487
|
|
- fileName = URLDecoder.decode(fileName, "UTF-8");
|
488
|
|
- } catch (Exception e) {
|
489
|
|
- System.out.println("Error extracting filename from contentDisposition: " + e);
|
490
|
|
- System.out.println("Falling back to URLUtil.guessFileName");
|
491
|
|
- fileName = URLUtil.guessFileName(url,contentDisposition,mimetype);
|
492
|
|
- }
|
|
482
|
+ String fileName = URLUtil.guessFileName(url, contentDisposition, mimetype);
|
493
|
483
|
String downloadMessage = "Downloading " + fileName;
|
494
|
484
|
|
495
|
485
|
//Attempt to add cookie, if it exists
|