diff options
author | Vincent Petry <vincent@nextcloud.com> | 2021-11-17 11:19:10 +0300 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2021-11-17 11:43:25 +0300 |
commit | c92a0e415260dccb9092b9312ccd727de81bd0f7 (patch) | |
tree | e44c698206ca82b7091cf1c272e4e6132a6ac9f7 /lib/private/Files/Cache | |
parent | 67ebe75d0ee02977b95e43a31516d936d18514a2 (diff) |
Normalize directory entries in Encoding wrapper
Directory entry file names are now normalized in getMetaData(),
getDirectoryContents() and opendir().
This makes the scanner work properly as it assumes pre-normalized names.
In case the names were not normalized, the scanner will now skip the
entries and display a warning when applicable.
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'lib/private/Files/Cache')
-rw-r--r-- | lib/private/Files/Cache/Scanner.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index f31885d54a6..bdefca01f6f 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -422,9 +422,12 @@ class Scanner extends BasicEmitter implements IScanner { } $originalFile = $fileMeta['name']; $file = trim(\OC\Files\Filesystem::normalizePath($originalFile), '/'); - if (trim($originalFile, '/') !== $file && !$this->storage->instanceOfStorage(Encoding::class)) { + if (trim($originalFile, '/') !== $file) { // encoding mismatch, might require compatibility wrapper + \OC::$server->getLogger()->debug('Scanner: Skipping non-normalized file name "'. $originalFile . '" in path "' . $path . '".', ['app' => 'core']); $this->emit('\OC\Files\Cache\Scanner', 'normalizedNameMismatch', [$path ? $path . '/' . $originalFile : $originalFile]); + // skip this entry + continue; } $newChildNames[] = $file; |