diff options
author | Julius Härtl <jus@bitgrid.net> | 2023-08-17 13:23:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-17 13:23:04 +0200 |
commit | 45595a8417dd426b2e40c741ba5e3bf7e4138b54 (patch) | |
tree | c0d6ca2e0ac7eb5c02e07881bab647f343d43ad8 /lib | |
parent | 1406eecf6c248ca6112f4b0faed5bfbf0673abcd (diff) | |
parent | 556f29bef5b2e9c5705b3ff2b31994c7c58fa5d0 (diff) | |
download | nextcloud-server-45595a8417dd426b2e40c741ba5e3bf7e4138b54.tar.gz nextcloud-server-45595a8417dd426b2e40c741ba5e3bf7e4138b54.zip |
Merge pull request #39481 from nextcloud/fix/transfer-ownersip
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/View.php | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index d256003537d..71815939310 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -744,14 +744,18 @@ class View { // if it was a rename from a part file to a regular file it was a write and not a rename operation $this->emit_file_hooks_pre($exists, $target, $run); } elseif ($this->shouldEmitHooks($source)) { - \OC_Hook::emit( - Filesystem::CLASSNAME, Filesystem::signal_rename, - [ - Filesystem::signal_param_oldpath => $this->getHookPath($source), - Filesystem::signal_param_newpath => $this->getHookPath($target), - Filesystem::signal_param_run => &$run - ] - ); + $sourcePath = $this->getHookPath($source); + $targetPath = $this->getHookPath($target); + if ($sourcePath !== null && $targetPath !== null) { + \OC_Hook::emit( + Filesystem::CLASSNAME, Filesystem::signal_rename, + [ + Filesystem::signal_param_oldpath => $sourcePath, + Filesystem::signal_param_newpath => $targetPath, + Filesystem::signal_param_run => &$run + ] + ); + } } if ($run) { $this->verifyPath(dirname($target), basename($target)); @@ -817,14 +821,18 @@ class View { } } elseif ($result) { if ($this->shouldEmitHooks($source) && $this->shouldEmitHooks($target)) { - \OC_Hook::emit( - Filesystem::CLASSNAME, - Filesystem::signal_post_rename, - [ - Filesystem::signal_param_oldpath => $this->getHookPath($source), - Filesystem::signal_param_newpath => $this->getHookPath($target) - ] - ); + $sourcePath = $this->getHookPath($source); + $targetPath = $this->getHookPath($target); + if ($sourcePath !== null && $targetPath !== null) { + \OC_Hook::emit( + Filesystem::CLASSNAME, + Filesystem::signal_post_rename, + [ + Filesystem::signal_param_oldpath => $sourcePath, + Filesystem::signal_param_newpath => $targetPath, + ] + ); + } } } } |