mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 01:30:50 -04:00
fix(files_versions): only handle path updates when there is path
`getPathForNode` can fail with null for various reasons (e.g. no owner), in this cases we need to just skip the event handling. Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de> Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com> Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
5862d5aea1
commit
8ca23f2c7d
1 changed files with 12 additions and 4 deletions
|
|
@ -332,11 +332,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);
|
||||
|
|
@ -344,7 +352,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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue