Merge pull request #59961 from nextcloud/fix/use-correct-regex-for-previews

fix(LocalPreviewStorage): Use correct regex to detect files in nested directory format
This commit is contained in:
David Dreschner 2026-05-04 15:19:07 +02:00 committed by GitHub
commit 020c4e9b59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -281,7 +281,7 @@ class LocalPreviewStorage implements IPreviewStorage {
// Move old flat preview to new nested directory format.
$dirName = str_replace($this->getPreviewRootFolder(), '', $item['filePath']);
if (preg_match('/[0-9a-e]\/[0-9a-e]\/[0-9a-e]\/[0-9a-e]\/[0-9a-e]\/[0-9a-e]\/[0-9a-e]\/[0-9]+/', $dirName) !== 1) {
if (preg_match('/([[:xdigit:]]\/){7}[0-9]+/', $dirName) !== 1) {
$previewPath = $this->constructPath($preview);
$this->createParentFiles($previewPath);
$ok = rename($item['realPath'], $previewPath);