diff options
author | Robin Appelman <robin@icewind.nl> | 2022-03-31 12:43:18 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-04-04 15:40:28 +0200 |
commit | d84f9fa9bbebb5dd069eaa74ad3b833b587503ae (patch) | |
tree | 4d175829ac7ff286520f84571a562a82312035fe | |
parent | 754603a04e24a40778816d9965fe31ac7b407910 (diff) | |
download | nextcloud-server-d84f9fa9bbebb5dd069eaa74ad3b833b587503ae.tar.gz nextcloud-server-d84f9fa9bbebb5dd069eaa74ad3b833b587503ae.zip |
rename cached fileinfo on rename
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | lib/private/Files/Node/Node.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php index 03975146dda..c8975154059 100644 --- a/lib/private/Files/Node/Node.php +++ b/lib/private/Files/Node/Node.php @@ -430,6 +430,15 @@ class Node implements \OCP\Files\Node { if (!$this->view->rename($this->path, $targetPath)) { throw new NotPermittedException('Could not move ' . $this->path . ' to ' . $targetPath); } + + $mountPoint = $this->getMountPoint(); + if ($mountPoint) { + // update the cached fileinfo with the new (internal) path + /** @var \OC\Files\FileInfo $oldFileInfo */ + $oldFileInfo = $this->getFileInfo(); + $this->fileInfo = new \OC\Files\FileInfo($targetPath, $oldFileInfo->getStorage(), $mountPoint->getInternalPath($targetPath), $oldFileInfo->getData(), $mountPoint, $oldFileInfo->getOwner()); + } + $targetNode = $this->root->get($targetPath); $this->sendHooks(['postRename'], [$this, $targetNode]); $this->sendHooks(['postWrite'], [$targetNode]); |