Index: chrome/browser/ui/bookmarks/bookmark_utils.cc |
diff --git a/chrome/browser/ui/bookmarks/bookmark_utils.cc b/chrome/browser/ui/bookmarks/bookmark_utils.cc |
index 13c2e18ab67b583d7f316d3e6d1730f19dd3a99b..ffebacaa0f6864fd57e0d0cda9b2dbb08552a13c 100644 |
--- a/chrome/browser/ui/bookmarks/bookmark_utils.cc |
+++ b/chrome/browser/ui/bookmarks/bookmark_utils.cc |
@@ -126,13 +126,20 @@ void ToggleBookmarkBarWhenVisible(content::BrowserContext* browser_context) { |
base::string16 FormatBookmarkURLForDisplay(const GURL& url) { |
// Because this gets re-parsed by FixupURL(), it's safe to omit the scheme |
- // and trailing slash, and unescape most characters. However, it's |
+ // and trailing slash, and unescape most characters. However, it's |
// important not to drop any username/password, or unescape anything that |
// changes the URL's meaning. |
- return url_formatter::FormatUrl( |
- url, url_formatter::kFormatUrlOmitAll & |
- ~url_formatter::kFormatUrlOmitUsernamePassword, |
- net::UnescapeRule::SPACES, nullptr, nullptr, nullptr); |
+ url_formatter::FormatUrlTypes format_types = |
+ url_formatter::kFormatUrlOmitAll & |
+ ~url_formatter::kFormatUrlOmitUsernamePassword; |
+ |
+ // If username is present, we must not omit the scheme because FixupURL() will |
+ // subsequently interpret the username as a scheme. crbug.com/639126 |
+ if (url.has_username()) |
+ format_types &= ~url_formatter::kFormatUrlOmitHTTP; |
+ |
+ return url_formatter::FormatUrl(url, format_types, net::UnescapeRule::SPACES, |
+ nullptr, nullptr, nullptr); |
} |
bool IsAppsShortcutEnabled(Profile* profile) { |