Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1070)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerDelegate.java

Issue 2876853007: Fix an issue that download fails for non-http(s) protocols (Closed)
Patch Set: nit Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerDelegate.java
index ee41a0f07fc472471867e0eda20777efb58da4b4..7eb85a190b881d1260d08093b2d79188457382ac 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerDelegate.java
@@ -99,11 +99,14 @@ public class DownloadManagerDelegate {
Class[] args = {String.class, String.class, boolean.class, String.class,
String.class, long.class, boolean.class, Uri.class, Uri.class};
Method method = c.getMethod("addCompletedDownload", args);
- // OriginalUri has to be null or non-empty, and cannot be file scheme.
+ // OriginalUri has to be null or non-empty http(s) scheme.
Uri originalUri = TextUtils.isEmpty(originalUrl) ? null : Uri.parse(originalUrl);
- if (originalUri != null && UrlConstants.FILE_SCHEME.equals(
- originalUri.normalizeScheme().getScheme())) {
- originalUri = null;
+ if (originalUri != null) {
+ String scheme = originalUri.normalizeScheme().getScheme();
+ if (scheme == null || (!scheme.equals(UrlConstants.HTTPS_SCHEME)
+ && !scheme.equals(UrlConstants.HTTP_SCHEME))) {
+ originalUri = null;
+ }
}
Uri refererUri = TextUtils.isEmpty(referer) ? null : Uri.parse(referer);
downloadId = (Long) method.invoke(manager, fileName, description, true, mimeType,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698