diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index e34f921199737..86ec0f6c58cf6 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -939,7 +939,7 @@ public function copy($source, $target, $preserveMtime = false) { try { $exists = $this->file_exists($target); - if ($this->shouldEmitHooks($target)) { + if ($this->shouldEmitHooks($source) && $this->shouldEmitHooks($target)) { \OC_Hook::emit( Filesystem::CLASSNAME, Filesystem::signal_copy, @@ -979,7 +979,7 @@ public function copy($source, $target, $preserveMtime = false) { $this->changeLock($target, ILockingProvider::LOCK_SHARED); $lockTypePath2 = ILockingProvider::LOCK_SHARED; - if ($this->shouldEmitHooks($target) && $result !== false) { + if ($this->shouldEmitHooks($source) && $this->shouldEmitHooks($target) && $result !== false) { \OC_Hook::emit( Filesystem::CLASSNAME, Filesystem::signal_post_copy,