diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-04-23 11:53:24 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-04-23 11:53:24 +0300 |
commit | 1722044992d8b8d5bcabcbd0b756f8564bf00d8a (patch) | |
tree | 1b0a21847a47eeb6064ece1bbb557c4ad54fc9b8 /apps/dav/lib/Connector/Sabre | |
parent | 513aba623ec02667629b8eb234507cd0feb3c4c3 (diff) |
Only set copy etag if the destination source can be found
The etag is only set for files, but it's also possible that in edge
cases the copy destination node can't be found. In that case we don't
need to set any etag.
Required for #26083
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/dav/lib/Connector/Sabre')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/CopyEtagHeaderPlugin.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/dav/lib/Connector/Sabre/CopyEtagHeaderPlugin.php b/apps/dav/lib/Connector/Sabre/CopyEtagHeaderPlugin.php index 9d58b25aa5a..0da15c113ee 100644 --- a/apps/dav/lib/Connector/Sabre/CopyEtagHeaderPlugin.php +++ b/apps/dav/lib/Connector/Sabre/CopyEtagHeaderPlugin.php @@ -25,6 +25,7 @@ namespace OCA\DAV\Connector\Sabre; +use Sabre\DAV\Exception\NotFound; use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; @@ -74,7 +75,13 @@ class CopyEtagHeaderPlugin extends \Sabre\DAV\ServerPlugin { * @return void */ public function afterMove($source, $destination) { - $node = $this->server->tree->getNodeForPath($destination); + try { + $node = $this->server->tree->getNodeForPath($destination); + } catch (NotFound $e) { + // Don't care + return; + } + if ($node instanceof File) { $eTag = $node->getETag(); $this->server->httpResponse->setHeader('OC-ETag', $eTag); |