diff options
author | Vincent Petry <vincent@nextcloud.com> | 2021-11-10 15:09:25 +0100 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2021-11-17 09:24:13 +0100 |
commit | 67ebe75d0ee02977b95e43a31516d936d18514a2 (patch) | |
tree | faabc953b23e23c9415c11d0d578536268bea04f /apps/files/lib/Command/ScanAppData.php | |
parent | 39fe43b914743985693e6243618109aacf8a3882 (diff) | |
download | nextcloud-server-67ebe75d0ee02977b95e43a31516d936d18514a2.tar.gz nextcloud-server-67ebe75d0ee02977b95e43a31516d936d18514a2.zip |
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 'apps/files/lib/Command/ScanAppData.php')
-rw-r--r-- | apps/files/lib/Command/ScanAppData.php | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/apps/files/lib/Command/ScanAppData.php b/apps/files/lib/Command/ScanAppData.php index 09153643727..59281b52bc4 100644 --- a/apps/files/lib/Command/ScanAppData.php +++ b/apps/files/lib/Command/ScanAppData.php @@ -73,15 +73,6 @@ class ScanAppData extends Base { $this->addArgument('folder', InputArgument::OPTIONAL, 'The appdata subfolder to scan', ''); } - public function checkScanWarning($fullPath, OutputInterface $output) { - $normalizedPath = basename(\OC\Files\Filesystem::normalizePath($fullPath)); - $path = basename($fullPath); - - if ($normalizedPath !== $path) { - $output->writeln("\t<error>Entry \"" . $fullPath . '" will not be accessible due to incompatible encoding</error>'); - } - } - protected function scanFiles(OutputInterface $output, string $folder): int { try { $appData = $this->getAppDataFolder(); @@ -124,12 +115,8 @@ class ScanAppData extends Base { $output->writeln('Error while scanning, storage not available (' . $e->getMessage() . ')', OutputInterface::VERBOSITY_VERBOSE); }); - $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) { - $this->checkScanWarning($path, $output); - }); - - $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) { - $this->checkScanWarning($path, $output); + $scanner->listen('\OC\Files\Utils\Scanner', 'normalizedNameMismatch', function ($fullPath) use ($output) { + $output->writeln("\t<error>Entry \"" . $fullPath . '" will not be accessible due to incompatible encoding</error>'); }); try { |