diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php index f9042fc076569..c5c10a1213bca 100644 --- a/apps/files_sharing/lib/Cache.php +++ b/apps/files_sharing/lib/Cache.php @@ -125,6 +125,19 @@ protected function formatCacheEntry($entry, $path = null) { if (is_null($path)) { $path = $entry['path'] ?? ''; $entry['path'] = $this->getJailedPath($path); + + if ($entry['path'] === null) { + if ($this->inCache($entry['name'])) { + // $cache->remove($content['fileid']); + } else { + // We didn't find a duplicate, update the entry with the correct path. + $path = $this->getRoot() . '/' . $entry['name']; + $data = $entry->getData(); + $data['path'] = $path; + $this->update($entry['fileid'], $data); + $entry['path'] = $this->getJailedPath($path); + } + } } else { $entry['path'] = $path; }