Skip to content

Commit

Permalink
Change postRename hook to fix #1139
Browse files Browse the repository at this point in the history
Change the postRename hook because calling the getId() function on the $source node throws an exception.
But because we're moving the file $source and $target are the same file.

It was fixed in the same way for moving folders in #1003

Signed-off-by: Florian Wallner <[email protected]>
  • Loading branch information
powerflo authored Oct 17, 2023
1 parent 2a3893c commit bb28497
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Hooks/FileHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public function register() {
if ($target->getType() === FileInfo::TYPE_FILE) {
// if moved (parents are different) => update DB with access list
if ($source->getParent()->getId() !== $target->getParent()->getId()) {
$this->photofilesService->deleteByFile($source);
// we renamed therefore target and source are identical
$this->photofilesService->deleteByFile($target);
$this->photofilesService->addByFile($target);
// tracks: nothing to do here because we use fileID
}
Expand Down

0 comments on commit bb28497

Please sign in to comment.