From a23de85783d944cbb75f09737eb29c60ea87481d Mon Sep 17 00:00:00 2001 From: "mhm@chromium.org" Date: Wed, 3 Jun 2009 02:16:32 +0000 Subject: Local text file with spaces in filename is urlencoded in tab title When viewing a local text file with spaces in filename, it is still urlencoded. Filename should be displayed with spaces, not with urlencoding. It would be more user-friendly. Since net::FormatURL is already implemented, using it would be great. But it doesn't escape SPACES, just NORMAL, it doesn't even escape unicode. I plumbed out a unescapeurl that could be used whether we allow conversion of spaces or not. BUG=8775 (http://crbug.com/8775) TEST=Tested whether the input is escaped in the navigational context and ran the net tests New Review: http://codereview.chromium.org/118059 Review URL: http://codereview.chromium.org/56053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17462 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/net/url_fixer_upper.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'chrome/browser/net') diff --git a/chrome/browser/net/url_fixer_upper.cc b/chrome/browser/net/url_fixer_upper.cc index f2c29ca..4097b88 100644 --- a/chrome/browser/net/url_fixer_upper.cc +++ b/chrome/browser/net/url_fixer_upper.cc @@ -121,7 +121,8 @@ static string FixupPath(const string& text) { // Here, we know the input looks like a file. GURL file_url = net::FilePathToFileURL(FilePath(filename)); if (file_url.is_valid()) { - return WideToUTF8(net::FormatUrl(file_url, std::wstring())); + return WideToUTF8(net::FormatUrl(file_url, std::wstring(), true, + UnescapeRule::NORMAL, NULL, NULL)); } // Invalid file URL, just return the input. @@ -520,7 +521,8 @@ string URLFixerUpper::FixupRelativeFile(const FilePath& base_dir, if (is_file) { GURL file_url = net::FilePathToFileURL(full_path); if (file_url.is_valid()) - return WideToUTF8(net::FormatUrl(file_url, std::wstring())); + return WideToUTF8(net::FormatUrl(file_url, std::wstring(), + true, UnescapeRule::NORMAL, NULL, NULL)); // Invalid files fall through to regular processing. } -- cgit v1.1