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

Unified Diff: net/base/data_url.cc

Issue 555383003: [Regression fix] [Data URI parser] Accept data URI with invalid mediatype data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refined the comment Created 6 years, 3 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 | « net/base/data_url.h ('k') | net/base/data_url_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
« no previous file with comments | « net/base/data_url.h ('k') | net/base/data_url_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698