diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-02-06 15:03:29 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-02-06 15:03:29 +0100 |
commit | 4d91fa4c93aa88480a52eed40fe65d7fdd4912d4 (patch) | |
tree | 6c3a8b06122c8743fa1cd84e6aeda01fc023a758 /tests | |
parent | 80e38b84dccde44c40109e9721fac00984f43ef7 (diff) | |
download | nextcloud-server-4d91fa4c93aa88480a52eed40fe65d7fdd4912d4.tar.gz nextcloud-server-4d91fa4c93aa88480a52eed40fe65d7fdd4912d4.zip |
Normalize before processing
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/files/filesystem.php | 22 | ||||
-rw-r--r-- | tests/lib/files/mapper.php | 9 |
2 files changed, 31 insertions, 0 deletions
diff --git a/tests/lib/files/filesystem.php b/tests/lib/files/filesystem.php index 888690adb0e..7bf59315d77 100644 --- a/tests/lib/files/filesystem.php +++ b/tests/lib/files/filesystem.php @@ -187,6 +187,28 @@ class Filesystem extends \Test\TestCase { $this->assertSame($expected, \OC\Files\Filesystem::isValidPath($path)); } + public function isFileBlacklistedData() { + return array( + array('/etc/foo/bar/foo.txt', false), + array('\etc\foo/bar\foo.txt', false), + array('.htaccess', true), + array('.htaccess/', true), + array('.htaccess\\', true), + array('/etc/foo\bar/.htaccess\\', true), + array('/etc/foo\bar/.htaccess/', true), + array('/etc/foo\bar/.htaccess/foo', false), + array('//foo//bar/\.htaccess/', true), + array('\foo\bar\.HTAccess', true), + ); + } + + /** + * @dataProvider isFileBlacklistedData + */ + public function testIsFileBlacklisted($path, $expected) { + $this->assertSame($expected, \OC\Files\Filesystem::isFileBlacklisted($path)); + } + public function normalizePathWindowsAbsolutePathData() { return array( array('C:/', 'C:\\'), diff --git a/tests/lib/files/mapper.php b/tests/lib/files/mapper.php index 18161734b60..cd35d4f8fc3 100644 --- a/tests/lib/files/mapper.php +++ b/tests/lib/files/mapper.php @@ -68,6 +68,15 @@ class Mapper extends \Test\TestCase { */ array('D:/' . md5('ありがとう'), 'D:/ありがとう'), array('D:/' . md5('ありがとう') . '/issue6722.txt', 'D:/ありがとう/issue6722.txt'), + array('D:/' . md5('.htaccess'), 'D:/.htaccess'), + array('D:/' . md5('.htaccess.'), 'D:/.htaccess.'), + array('D:/' . md5('.htAccess'), 'D:/.htAccess'), + array('D:/' . md5('.htAccess\\…\\') . '/a', 'D:/.htAccess\…\/とa'), + array('D:/' . md5('.htaccess-'), 'D:/.htaccess-'), + array('D:/' . md5('.htaあccess'), 'D:/.htaあccess'), + array('D:/' . md5(' .htaccess'), 'D:/ .htaccess'), + array('D:/' . md5('.htaccess '), 'D:/.htaccess '), + array('D:/' . md5(' .htaccess '), 'D:/ .htaccess '), ); } |