From 39fe43b914743985693e6243618109aacf8a3882 Mon Sep 17 00:00:00 2001
From: Vincent Petry <vincent@nextcloud.com>
Date: Tue, 9 Nov 2021 11:56:10 +0100
Subject: Normalize file name before existence check in scanner

The scanner would not find a NFD-encoded file name in an
existing file list that is normalized.

This normalizes the file name before scanning.

Fixes issues where scanning repeatedly would make NFD files flicker in
and out of existence in the file cache.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
---
 lib/private/Files/Cache/Scanner.php | 1 +
 1 file changed, 1 insertion(+)

(limited to 'lib')

diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php
index 8baab8746fc..a88d49d32c2 100644
--- a/lib/private/Files/Cache/Scanner.php
+++ b/lib/private/Files/Cache/Scanner.php
@@ -420,6 +420,7 @@ class Scanner extends BasicEmitter implements IScanner {
 				continue;
 			}
 			$file = $fileMeta['name'];
+			$file = trim(\OC\Files\Filesystem::normalizePath($file), '/');
 			$newChildNames[] = $file;
 			$child = $path ? $path . '/' . $file : $file;
 			try {
-- 
cgit v1.2.3