Index: net/base/data_url.cc |
diff --git a/net/base/data_url.cc b/net/base/data_url.cc |
index 0ec345ea6dbf4f89ed5701e132109e6c7e411a41..01b7f398db1b668909d997731ec48564928f1271 100644 |
--- a/net/base/data_url.cc |
+++ b/net/base/data_url.cc |
@@ -65,11 +65,12 @@ bool DataURL::Parse(const GURL& url, std::string* mime_type, |
} |
} |
- if (mime_type->empty()) { |
- // fallback to defaults if nothing specified in the URL: |
+ if (mime_type->empty() || |
+ !ParseMimeTypeWithoutParameter(*mime_type, NULL, NULL)) { |
+ // Fallback to the default if nothing specified in the mediatype part as |
+ // specified in RFC2045. We also fallback to the default when the mediatype |
+ // value is invalid as recommended in the RFC. |
mime_type->assign("text/plain"); |
asanka
2014/09/30 18:35:51
If you are setting the mime_type, also set the cha
tyoshino (SeeGerritForStatus)
2014/10/01 01:03:54
As specified in RFC2397, when the mime type is emp
|
- } else if (!ParseMimeTypeWithoutParameter(*mime_type, NULL, NULL)) { |
- return false; |
} |
if (charset->empty()) |
charset->assign("US-ASCII"); |