diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-03-17 23:50:16 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-03-17 23:50:16 +0100 |
commit | c69cd28a734de8dd974223da4e9ff652b4baca46 (patch) | |
tree | 0dd1e46e0060af488c91142467823a3876387ebf | |
parent | a4d2c7810e0e11840f60211c8c87ae4443791e11 (diff) | |
parent | f13216d275fc59d448e91aab5e817bff5627d3d9 (diff) | |
download | nextcloud-server-c69cd28a734de8dd974223da4e9ff652b4baca46.tar.gz nextcloud-server-c69cd28a734de8dd974223da4e9ff652b4baca46.zip |
Merge pull request #14968 from owncloud/files-reallowsinglequote
Reallow single quote in file names
-rw-r--r-- | lib/private/files/storage/common.php | 2 | ||||
-rw-r--r-- | tests/lib/files/pathverificationtest.php | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index 031a2f1cb7a..5de243e177a 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -512,7 +512,7 @@ abstract class Common implements \OC\Files\Storage\Storage { } } - $sanitizedFileName = filter_var($fileName, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); + $sanitizedFileName = filter_var($fileName, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW); if($sanitizedFileName !== $fileName) { throw new InvalidCharacterInPathException(); } diff --git a/tests/lib/files/pathverificationtest.php b/tests/lib/files/pathverificationtest.php index 5d38c6291a6..65342c7799e 100644 --- a/tests/lib/files/pathverificationtest.php +++ b/tests/lib/files/pathverificationtest.php @@ -230,4 +230,30 @@ class PathVerification extends \Test\TestCase { ]; } + /** + * @dataProvider providesValidPosixPaths + */ + public function testPathVerificationValidPaths($fileName) { + $storage = new Local(['datadir' => '']); + + \Test_Helper::invokePrivate($storage, 'verifyPosixPath', [$fileName]); + \Test_Helper::invokePrivate($storage, 'verifyWindowsPath', [$fileName]); + // nothing thrown + $this->assertTrue(true); + } + + public function providesValidPosixPaths() { + return [ + ['simple'], + ['simple.txt'], + ['\''], + ['`'], + ['%'], + ['()'], + ['[]'], + ['!'], + ['$'], + ['_'], + ]; + } } |