Chromium Code Reviews| Index: net/base/data_url.cc |
| diff --git a/net/base/data_url.cc b/net/base/data_url.cc |
| index 58036c6a369061e6a97c791e728f107da7f8046e..43cf23a98170e43719336fb41f62f7d10ffebcc5 100644 |
| --- a/net/base/data_url.cc |
| +++ b/net/base/data_url.cc |
| @@ -20,8 +20,10 @@ |
| namespace net { |
| // static |
| -bool DataURL::Parse(const GURL& url, std::string* mime_type, |
| - std::string* charset, std::string* data) { |
| +bool DataURL::Parse(const GURL& url, |
| + std::string* mime_type, |
| + std::string* charset, |
| + std::string* data) { |
| DCHECK(mime_type->empty()); |
| DCHECK(charset->empty()); |
| std::string::const_iterator begin = url.spec().begin(); |
| @@ -98,22 +100,26 @@ bool DataURL::Parse(const GURL& url, std::string* mime_type, |
| // could be part of the payload, so don't strip it. |
| if (base64_encoded) { |
| temp_data = UnescapeURLComponent(temp_data, |
| - UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS | |
| - UnescapeRule::CONTROL_CHARS); |
| + UnescapeRule::SPACES | |
|
mef
2014/10/10 20:38:17
this is definitely wrong.
|
| + UnescapeRule::URL_SPECIAL_CHARS | |
| + UnescapeRule::CONTROL_CHARS); |
| } |
| // Strip whitespace. |
| - if (base64_encoded || !(mime_type->compare(0, 5, "text/") == 0 || |
| - mime_type->find("xml") != std::string::npos)) { |
| - temp_data.erase(std::remove_if(temp_data.begin(), temp_data.end(), |
| - IsAsciiWhitespace<wchar_t>), |
| - temp_data.end()); |
| + if (base64_encoded || |
| + !(mime_type->compare(0, 5, "text/") == 0 || |
| + mime_type->find("xml") != std::string::npos)) { |
| + temp_data.erase( |
| + std::remove_if( |
| + temp_data.begin(), temp_data.end(), IsAsciiWhitespace<wchar_t>), |
| + temp_data.end()); |
| } |
| if (!base64_encoded) { |
| temp_data = UnescapeURLComponent(temp_data, |
| - UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS | |
| - UnescapeRule::CONTROL_CHARS); |
| + UnescapeRule::SPACES | |
| + UnescapeRule::URL_SPECIAL_CHARS | |
| + UnescapeRule::CONTROL_CHARS); |
| } |
| if (base64_encoded) { |