diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 22:42:29 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 22:42:29 +0000 |
commit | ba1321d147d0a2a3e05fb573a4627ca1ba34b357 (patch) | |
tree | c009e15b7675fdde482ec99f5361c6e63bb6bbde /chrome/browser/net/url_fixer_upper.cc | |
parent | 7f1a907d93ee0f7ac527424a70e245343ce0539a (diff) | |
download | chromium_src-ba1321d147d0a2a3e05fb573a4627ca1ba34b357.zip chromium_src-ba1321d147d0a2a3e05fb573a4627ca1ba34b357.tar.gz chromium_src-ba1321d147d0a2a3e05fb573a4627ca1ba34b357.tar.bz2 |
posix: URLFixerUpper would DCHECK on input "/".
Also, add some more tests to cover this case.
Review URL: http://codereview.chromium.org/87048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14148 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/url_fixer_upper.cc')
-rw-r--r-- | chrome/browser/net/url_fixer_upper.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/chrome/browser/net/url_fixer_upper.cc b/chrome/browser/net/url_fixer_upper.cc index 9fb17c4..edccfa0 100644 --- a/chrome/browser/net/url_fixer_upper.cc +++ b/chrome/browser/net/url_fixer_upper.cc @@ -103,18 +103,20 @@ static bool ValidPathForFile(const FilePath::StringType& text, // file: URLs: these don't look like filenames), leaving fixed_up_url // unchanged. static string FixupPath(const string& text) { - DCHECK(text.length() >= 2); + DCHECK(!text.empty()); FilePath::StringType filename; #if defined(OS_WIN) FilePath input_path(UTF8ToWide(text)); -#elif defined(OS_POSIX) - FilePath input_path(text); -#endif PrepareStringForFileOps(input_path, &filename); - if (filename[1] == '|') + // Fixup Windows-style drive letters, where "C:" gets rewritten to "C|". + if (filename.length() > 1 && filename[1] == '|') filename[1] = ':'; +#elif defined(OS_POSIX) + FilePath input_path(text); + PrepareStringForFileOps(input_path, &filename); +#endif // Here, we know the input looks like a file. GURL file_url = net::FilePathToFileURL(FilePath(filename)); |