Add keepUnicode value in the cache key of normalizedPathCache
This commit is contained in:
parent
7b4459d28d
commit
5ad8fa7675
2 changed files with 28 additions and 1 deletions
|
@ -781,7 +781,7 @@ class Filesystem {
|
|||
*/
|
||||
$path = (string)$path;
|
||||
|
||||
$cacheKey = json_encode([$path, $stripTrailingSlash, $isAbsolutePath]);
|
||||
$cacheKey = json_encode([$path, $stripTrailingSlash, $isAbsolutePath, $keepUnicode]);
|
||||
|
||||
if (isset(self::$normalizedPathCache[$cacheKey])) {
|
||||
return self::$normalizedPathCache[$cacheKey];
|
||||
|
|
|
@ -92,6 +92,7 @@ class FilesystemTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
$this->logout();
|
||||
$this->invokePrivate('\OC\Files\Filesystem', 'normalizedPathCache', [null]);
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
|
@ -190,6 +191,32 @@ class FilesystemTest extends \Test\TestCase {
|
|||
$this->assertEquals($expected, \OC\Files\Filesystem::normalizePath($path, $stripTrailingSlash));
|
||||
}
|
||||
|
||||
public function normalizePathKeepUnicodeData() {
|
||||
$nfdName = 'ümlaut';
|
||||
$nfcName = 'ümlaut';
|
||||
return [
|
||||
['/' . $nfcName, $nfcName, true],
|
||||
['/' . $nfcName, $nfcName, false],
|
||||
['/' . $nfdName, $nfdName, true],
|
||||
['/' . $nfcName, $nfdName, false],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider normalizePathKeepUnicodeData
|
||||
*/
|
||||
public function testNormalizePathKeepUnicode($expected, $path, $keepUnicode = false) {
|
||||
$this->assertEquals($expected, \OC\Files\Filesystem::normalizePath($path, true, false, $keepUnicode));
|
||||
}
|
||||
|
||||
public function testNormalizePathKeepUnicodeCache() {
|
||||
$nfdName = 'ümlaut';
|
||||
$nfcName = 'ümlaut';
|
||||
// call in succession due to cache
|
||||
$this->assertEquals('/' . $nfcName, \OC\Files\Filesystem::normalizePath($nfdName, true, false, false));
|
||||
$this->assertEquals('/' . $nfdName, \OC\Files\Filesystem::normalizePath($nfdName, true, false, true));
|
||||
}
|
||||
|
||||
public function isValidPathData() {
|
||||
return array(
|
||||
array('/', true),
|
||||
|
|
Loading…
Reference in a new issue