Skip to content

Commit 1bdc3c2

Browse files
Merge pull request #58671 from nextcloud/backport/58660/stable31
[stable31] fix: check source and target when emitting copy event
2 parents d4aae76 + 59cf608 commit 1bdc3c2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/private/Files/View.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ public function copy($source, $target, $preserveMtime = false) {
937937

938938
try {
939939
$exists = $this->file_exists($target);
940-
if ($this->shouldEmitHooks($target)) {
940+
if ($this->shouldEmitHooks($source) && $this->shouldEmitHooks($target)) {
941941
\OC_Hook::emit(
942942
Filesystem::CLASSNAME,
943943
Filesystem::signal_copy,
@@ -977,7 +977,7 @@ public function copy($source, $target, $preserveMtime = false) {
977977
$this->changeLock($target, ILockingProvider::LOCK_SHARED);
978978
$lockTypePath2 = ILockingProvider::LOCK_SHARED;
979979

980-
if ($this->shouldEmitHooks($target) && $result !== false) {
980+
if ($this->shouldEmitHooks($source) && $this->shouldEmitHooks($target) && $result !== false) {
981981
\OC_Hook::emit(
982982
Filesystem::CLASSNAME,
983983
Filesystem::signal_post_copy,

0 commit comments

Comments
 (0)