rename cached fileinfo on rename

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/31773/head
Robin Appelman 2022-03-31 12:43:18 +07:00
parent 754603a04e
commit d84f9fa9bb
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 9 additions and 0 deletions

@ -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]);