Skip to content

Commit

Permalink
Include "before" and "after" copy events as with move events
Browse files Browse the repository at this point in the history
  • Loading branch information
jvillafanez committed Mar 29, 2022
1 parent 130abb7 commit b282db9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/DAV/CorePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,10 @@ public function httpCopy(RequestInterface $request, ResponseInterface $response)
if (!$this->server->emit('beforeBind', [$copyInfo['destination']])) {
return false;
}
if (!$this->server->emit('beforeCopy', [$path, $copyInfo['destination']])) {
return false;
}

if ($copyInfo['destinationExists']) {
if (!$this->server->emit('beforeUnbind', [$copyInfo['destination']])) {
return false;
Expand All @@ -653,6 +657,7 @@ public function httpCopy(RequestInterface $request, ResponseInterface $response)
}

$this->server->tree->copy($path, $copyInfo['destination']);
$this->server->emit('afterCopy', [$path, $copyInfo['destination']]);
$this->server->emit('afterBind', [$copyInfo['destination']]);

// If a resource was overwritten we should send a 204, otherwise a 201
Expand Down

0 comments on commit b282db9

Please sign in to comment.