Merge pull request #14968 from owncloud/files-reallowsinglequote

Reallow single quote in file names
This commit is contained in:
Thomas Müller 2015-03-17 23:50:16 +01:00
commit c69cd28a73
2 changed files with 27 additions and 1 deletions

View File

@ -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) { if($sanitizedFileName !== $fileName) {
throw new InvalidCharacterInPathException(); throw new InvalidCharacterInPathException();
} }

View File

@ -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'],
['\''],
['`'],
['%'],
['()'],
['[]'],
['!'],
['$'],
['_'],
];
}
} }