diff options
author | mtomasz@chromium.org <mtomasz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-10 12:51:46 +0000 |
---|---|---|
committer | mtomasz@chromium.org <mtomasz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-10 12:51:46 +0000 |
commit | 31c55bee2cf3edcea8b1a087f7a34f50abddfb1d (patch) | |
tree | 323b8648abd99dcc1c134260c329fbfb26a17aa7 /content/common | |
parent | 73a66d2ad32e871954320363c0aa0ba305f1112b (diff) | |
download | chromium_src-31c55bee2cf3edcea8b1a087f7a34f50abddfb1d.zip chromium_src-31c55bee2cf3edcea8b1a087f7a34f50abddfb1d.tar.gz chromium_src-31c55bee2cf3edcea8b1a087f7a34f50abddfb1d.tar.bz2 |
[fsp] Fix incorrect handling of file system URLs when containing a %.
Mount point names can (and in case of File System Provider API often do) the %
character, in order to create a safe mount point name from an arbitrary file
system id, which can be any string, and often is a file name path. Such path
may contain /, which have to be escaped, since the mount point name must not
contain that character.
However, GetExternalFileSystemRootURIString() wasn't properly escaping the %
character, what caused treating it later as an encoding sequence of an url.
TEST=Tested manually with a file systems containing % in the mount point name.
BUG=248427
Review URL: https://codereview.chromium.org/312283002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276002 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r-- | content/common/fileapi/file_system_util_unittest.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/content/common/fileapi/file_system_util_unittest.cc b/content/common/fileapi/file_system_util_unittest.cc index 61dac02..a82dc90 100644 --- a/content/common/fileapi/file_system_util_unittest.cc +++ b/content/common/fileapi/file_system_util_unittest.cc @@ -10,7 +10,9 @@ using fileapi::CrackIsolatedFileSystemName; using fileapi::FileSystemType; +using fileapi::GetExternalFileSystemRootURIString; using fileapi::GetIsolatedFileSystemName; +using fileapi::GetIsolatedFileSystemRootURIString; using fileapi::ValidateIsolatedFileSystemId; using fileapi::VirtualPath; @@ -281,5 +283,26 @@ TEST_F(FileSystemUtilTest, ValidateIsolatedFileSystemId) { EXPECT_FALSE(ValidateIsolatedFileSystemId(kSpaceId)); } +TEST_F(FileSystemUtilTest, GetIsolatedFileSystemRootURIString) { + const GURL kOriginURL("http://foo"); + // Percents must be escaped, otherwise they will be unintentionally unescaped. + const std::string kFileSystemId = "A%20B"; + const std::string kRootName = "C%20D"; + + const std::string url_string = + GetIsolatedFileSystemRootURIString(kOriginURL, kFileSystemId, kRootName); + EXPECT_EQ("filesystem:http://foo/isolated/A%2520B/C%2520D/", url_string); +} + +TEST_F(FileSystemUtilTest, GetExternalFileSystemRootURIString) { + const GURL kOriginURL("http://foo"); + // Percents must be escaped, otherwise they will be unintentionally unescaped. + const std::string kMountName = "X%20Y"; + + const std::string url_string = + GetExternalFileSystemRootURIString(kOriginURL, kMountName); + EXPECT_EQ("filesystem:http://foo/external/X%2520Y/", url_string); +} + } // namespace } // namespace content |