Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-11-10 17:09:25 +0300
committerVincent Petry <vincent@nextcloud.com>2021-11-17 11:24:13 +0300
commit67ebe75d0ee02977b95e43a31516d936d18514a2 (patch)
treefaabc953b23e23c9415c11d0d578536268bea04f /lib/private/Files/Cache
parent39fe43b914743985693e6243618109aacf8a3882 (diff)
Move storage encoding compatibility warning logic
The encoding check for file names is now happening the Scanner, and an event will be emitted only if the storage doesn't contain the encoding compatibility wrapper. The event is listened to by the occ scan command to be able to display a warning in case of file name mismatches when they have NFD encoding. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'lib/private/Files/Cache')
-rw-r--r--lib/private/Files/Cache/Scanner.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php
index a88d49d32c2..f31885d54a6 100644
--- a/lib/private/Files/Cache/Scanner.php
+++ b/lib/private/Files/Cache/Scanner.php
@@ -37,6 +37,7 @@ namespace OC\Files\Cache;
use Doctrine\DBAL\Exception;
use OC\Files\Filesystem;
+use OC\Files\Storage\Wrapper\Encoding;
use OC\Hooks\BasicEmitter;
use OCP\Files\Cache\IScanner;
use OCP\Files\ForbiddenException;
@@ -419,8 +420,13 @@ class Scanner extends BasicEmitter implements IScanner {
if ($permissions === 0) {
continue;
}
- $file = $fileMeta['name'];
- $file = trim(\OC\Files\Filesystem::normalizePath($file), '/');
+ $originalFile = $fileMeta['name'];
+ $file = trim(\OC\Files\Filesystem::normalizePath($originalFile), '/');
+ if (trim($originalFile, '/') !== $file && !$this->storage->instanceOfStorage(Encoding::class)) {
+ // encoding mismatch, might require compatibility wrapper
+ $this->emit('\OC\Files\Cache\Scanner', 'normalizedNameMismatch', [$path ? $path . '/' . $originalFile : $originalFile]);
+ }
+
$newChildNames[] = $file;
$child = $path ? $path . '/' . $file : $file;
try {