Skip to content

Commit

Permalink
fix access array offset which doesn't exist
Browse files Browse the repository at this point in the history
Successor hook fileMovePost is only processed if no error occured in fileMove hook

Signed-off-by: Jan Messer <[email protected]>
  • Loading branch information
Messj1 committed Jul 23, 2024
1 parent 327dcd0 commit f371e65
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/FilesHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public function fileMove($oldPath, $newPath) {
return;
}

$moveCase = $this->moveCase;
if (strpos($oldDir, $newDir) === 0) {
/**
* a/b/c moved to a/c
Expand All @@ -243,7 +244,7 @@ public function fileMove($oldPath, $newPath) {
* - a/b/ shared: delete
* - a/ shared: move/rename
*/
$this->moveCase = 'moveUp';
$moveCase = 'moveUp';
} elseif (strpos($newDir, $oldDir) === 0) {
/**
* a/b moved to a/c/b
Expand All @@ -253,7 +254,7 @@ public function fileMove($oldPath, $newPath) {
* - a/c/ shared: add
* - a/ shared: move/rename
*/
$this->moveCase = 'moveDown';
$moveCase = 'moveDown';
} else {
/**
* a/b/c moved to a/d/c
Expand All @@ -264,7 +265,7 @@ public function fileMove($oldPath, $newPath) {
* - a/d/ shared: add
* - a/ shared: move/rename
*/
$this->moveCase = 'moveCross';
$moveCase = 'moveCross';
}

[$this->oldParentPath, $this->oldParentOwner, $this->oldParentId] = $this->getSourcePathAndOwner($oldDir);
Expand All @@ -282,6 +283,7 @@ public function fileMove($oldPath, $newPath) {
$oldAccessList['users'] = array_merge($oldAccessList['users'], $this->getAffectedUsersFromCachedMounts($oldFileId));
}

$this->moveCase = $moveCase;
$this->oldAccessList = $oldAccessList;
}

Expand Down

0 comments on commit f371e65

Please sign in to comment.