Merge pull request #53519 from nextcloud/backport/51609/stable30

[stable30] fix(files_versions): only handle path updates when there is path
This commit is contained in:
Andy Scherzinger 2025-06-18 10:09:02 +02:00 committed by GitHub
commit 18bbd08fbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -374,11 +374,19 @@ class FileEventsListener implements IEventListener {
return;
}
// if we rename a movable mount point, then the versions don't have
// to be renamed
// if we rename a movable mount point, then the versions don't have to be renamed
$oldPath = $this->getPathForNode($source);
$newPath = $this->getPathForNode($target);
$absOldPath = Filesystem::normalizePath('/' . \OC_User::getUser() . '/files' . $oldPath);
if ($oldPath === null || $newPath === null) {
return;
}
$user = $this->userSession->getUser()?->getUID();
if ($user === null) {
return;
}
$absOldPath = Filesystem::normalizePath('/' . $user . '/files' . $oldPath);
$manager = Filesystem::getMountManager();
$mount = $manager->find($absOldPath);
$internalPath = $mount->getInternalPath($absOldPath);
@ -386,7 +394,7 @@ class FileEventsListener implements IEventListener {
return;
}
$view = new View(\OC_User::getUser() . '/files');
$view = new View($user . '/files');
if ($view->file_exists($newPath)) {
Storage::store($newPath);
} else {