|
|
|
|
@ -97,63 +97,6 @@ class PathVerificationTest extends \Test\TestCase { |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dataProvider providesInvalidCharsWindows |
|
|
|
|
* @expectedException \OCP\Files\InvalidCharacterInPathException |
|
|
|
|
*/ |
|
|
|
|
public function testPathVerificationInvalidCharsWindows($fileName) { |
|
|
|
|
$storage = new Local(['datadir' => '']); |
|
|
|
|
|
|
|
|
|
$fileName = " 123{$fileName}456 "; |
|
|
|
|
self::invokePrivate($storage, 'verifyWindowsPath', [$fileName]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function providesInvalidCharsWindows() { |
|
|
|
|
return [ |
|
|
|
|
[\chr(0)], |
|
|
|
|
[\chr(1)], |
|
|
|
|
[\chr(2)], |
|
|
|
|
[\chr(3)], |
|
|
|
|
[\chr(4)], |
|
|
|
|
[\chr(5)], |
|
|
|
|
[\chr(6)], |
|
|
|
|
[\chr(7)], |
|
|
|
|
[\chr(8)], |
|
|
|
|
[\chr(9)], |
|
|
|
|
[\chr(10)], |
|
|
|
|
[\chr(11)], |
|
|
|
|
[\chr(12)], |
|
|
|
|
[\chr(13)], |
|
|
|
|
[\chr(14)], |
|
|
|
|
[\chr(15)], |
|
|
|
|
[\chr(16)], |
|
|
|
|
[\chr(17)], |
|
|
|
|
[\chr(18)], |
|
|
|
|
[\chr(19)], |
|
|
|
|
[\chr(20)], |
|
|
|
|
[\chr(21)], |
|
|
|
|
[\chr(22)], |
|
|
|
|
[\chr(23)], |
|
|
|
|
[\chr(24)], |
|
|
|
|
[\chr(25)], |
|
|
|
|
[\chr(26)], |
|
|
|
|
[\chr(27)], |
|
|
|
|
[\chr(28)], |
|
|
|
|
[\chr(29)], |
|
|
|
|
[\chr(30)], |
|
|
|
|
[\chr(31)], |
|
|
|
|
['<'], |
|
|
|
|
['>'], |
|
|
|
|
[':'], |
|
|
|
|
['"'], |
|
|
|
|
['/'], |
|
|
|
|
['\\'], |
|
|
|
|
['|'], |
|
|
|
|
['?'], |
|
|
|
|
['*'], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dataProvider providesInvalidCharsPosix |
|
|
|
|
* @expectedException \OCP\Files\InvalidCharacterInPathException |
|
|
|
|
@ -162,7 +105,7 @@ class PathVerificationTest extends \Test\TestCase { |
|
|
|
|
$storage = new Local(['datadir' => '']); |
|
|
|
|
|
|
|
|
|
$fileName = " 123{$fileName}456 "; |
|
|
|
|
self::invokePrivate($storage, 'verifyWindowsPath', [$fileName]); |
|
|
|
|
self::invokePrivate($storage, 'verifyPosixPath', [$fileName]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function providesInvalidCharsPosix() { |
|
|
|
|
@ -204,43 +147,6 @@ class PathVerificationTest extends \Test\TestCase { |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dataProvider providesReservedNamesWindows |
|
|
|
|
* @expectedException \OCP\Files\ReservedWordException |
|
|
|
|
*/ |
|
|
|
|
public function testPathVerificationReservedNamesWindows($fileName) { |
|
|
|
|
$storage = new Local(['datadir' => '']); |
|
|
|
|
|
|
|
|
|
self::invokePrivate($storage, 'verifyWindowsPath', [$fileName]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function providesReservedNamesWindows() { |
|
|
|
|
return [ |
|
|
|
|
[' CON '], |
|
|
|
|
['prn '], |
|
|
|
|
['AUX'], |
|
|
|
|
['NUL'], |
|
|
|
|
['COM1'], |
|
|
|
|
['COM2'], |
|
|
|
|
['COM3'], |
|
|
|
|
['COM4'], |
|
|
|
|
['COM5'], |
|
|
|
|
['COM6'], |
|
|
|
|
['COM7'], |
|
|
|
|
['COM8'], |
|
|
|
|
['COM9'], |
|
|
|
|
['LPT1'], |
|
|
|
|
['LPT2'], |
|
|
|
|
['LPT3'], |
|
|
|
|
['LPT4'], |
|
|
|
|
['LPT5'], |
|
|
|
|
['LPT6'], |
|
|
|
|
['LPT7'], |
|
|
|
|
['LPT8'], |
|
|
|
|
['LPT9'] |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dataProvider providesValidPosixPaths |
|
|
|
|
*/ |
|
|
|
|
@ -248,7 +154,6 @@ class PathVerificationTest extends \Test\TestCase { |
|
|
|
|
$storage = new Local(['datadir' => '']); |
|
|
|
|
|
|
|
|
|
self::invokePrivate($storage, 'verifyPosixPath', [$fileName]); |
|
|
|
|
self::invokePrivate($storage, 'verifyWindowsPath', [$fileName]); |
|
|
|
|
// nothing thrown |
|
|
|
|
$this->assertTrue(true); |
|
|
|
|
} |
|
|
|
|
|