Index: components/url_formatter/url_fixer.cc |
diff --git a/components/url_formatter/url_fixer.cc b/components/url_formatter/url_fixer.cc |
index 53abe4e0c4a910aa2a065160af3f35c0533352be..c49b31ba08cb4ee680a9498c64abbd69c728f9d6 100644 |
--- a/components/url_formatter/url_fixer.cc |
+++ b/components/url_formatter/url_fixer.cc |
@@ -480,7 +480,10 @@ std::string SegmentURLInternal(std::string* text, url::Parsed* parts) { |
// Construct the text to parse by inserting the scheme. |
std::string inserted_text(scheme); |
- inserted_text.append(url::kStandardSchemeSeparator); |
+ // Assume a leading colon was meant to be a scheme separator (which GURL will |
+ // fix up for us into the full "://"). Otherwise add the separator ourselves. |
+ if (first_nonwhite == text->end() || *first_nonwhite != ':') |
+ inserted_text.append(url::kStandardSchemeSeparator); |
std::string text_to_parse(text->begin(), first_nonwhite); |
text_to_parse.append(inserted_text); |
text_to_parse.append(first_nonwhite, text->end()); |