Index: net/base/filename_util_unittest.cc |
diff --git a/net/base/filename_util_unittest.cc b/net/base/filename_util_unittest.cc |
index 5e3fb7e1c9f91fe59b5702ce274034d87c6ce5aa..5b99452f3504aa57270809b1990402d379337b37 100644 |
--- a/net/base/filename_util_unittest.cc |
+++ b/net/base/filename_util_unittest.cc |
@@ -239,6 +239,9 @@ TEST(FilenameUtilTest, FileURLConversion) { |
{L"\\\\foo\\bar.txt", "file:/foo/bar.txt"}, |
{L"\\\\foo\\bar.txt", "file://foo\\bar.txt"}, |
{L"C:\\foo\\bar.txt", "file:\\\\\\c:/foo/bar.txt"}, |
+ // %2f ('/') and %5c ('\\') are left alone by both GURL and |
+ // FileURLToFilePath. |
+ {L"C:\\foo%2f..%5cbar", "file:///C:\\foo%2f..%5cbar"}, |
eroman
2016/02/18 19:37:28
What are the unescaping rules for %2e (dot) ?
mmenke
2016/02/18 20:30:22
Dots are unescaped in paths, since they have no ma
eroman
2016/02/18 21:17:22
But dots do have a magical meaning, which is no le
|
#elif defined(OS_POSIX) |
{L"/c:/foo/bar.txt", "file:/c:/foo/bar.txt"}, |
{L"/c:/foo/bar.txt", "file:///c:/foo/bar.txt"}, |
@@ -253,6 +256,9 @@ TEST(FilenameUtilTest, FileURLConversion) { |
{L"/foo/bar.txt", "file:////foo////bar.txt"}, |
{L"/c:/foo/bar.txt", "file:\\\\\\c:/foo/bar.txt"}, |
{L"/c:/foo/bar.txt", "file:c:/foo/bar.txt"}, |
+ // %2f ('/') and %5c ('\\') are left alone by both GURL and |
+ // FileURLToFilePath. |
+ {L"/foo%2f..%5cbar", "file:///foo%2f..%5cbar"}, |
// We get these wrong because GURL turns back slashes into forward |
// slashes. |
// {L"/foo%5Cbar.txt", "file://foo\\bar.txt"}, |
@@ -785,6 +791,16 @@ TEST(FilenameUtilTest, GenerateFileName) { |
"image/jpeg", |
L"download", |
L"download" JPEG_EXT}, |
+ {// Escaped slash, backslash, and leading periods in file name. The periods |
+ // should be removed, both slashes replaced with dashes. |
+ __LINE__, |
+ "http://www.google.com/..%2f%5ctest.html", |
+ "", |
+ "", |
+ "", |
+ "", |
+ L"", |
+ L"--test.html"}, |
}; |
// Tests filename generation. Once the correct filename is |