summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-02-08 17:49:25 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-02-08 17:49:25 +0100
commit703f3551dc2c9caaebbcd2e9d9377f314dfd28ea (patch)
tree2c140ae6353bb6e36fbd7c0048a50c7b03552f77 /apps
parent2cad9d2b8c6ba38aa12e566fe7f2754e445368ea (diff)
downloadnextcloud-server-703f3551dc2c9caaebbcd2e9d9377f314dfd28ea.tar.gz
nextcloud-server-703f3551dc2c9caaebbcd2e9d9377f314dfd28ea.zip
Only set the header if the node exists and in case the request is a GET
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/server.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/apps/dav/lib/server.php b/apps/dav/lib/server.php
index 0c25890b662..f5f1875a480 100644
--- a/apps/dav/lib/server.php
+++ b/apps/dav/lib/server.php
@@ -110,10 +110,15 @@ class Server {
// Serve all files with an Content-Disposition of type "attachment"
$this->server->on('beforeMethod', function (RequestInterface $requestInterface, ResponseInterface $responseInterface) {
- $node = $this->server->tree->getNodeForPath($requestInterface->getPath());
- if (($node instanceof IFile)) {
- $responseInterface->addHeader('Content-Disposition', 'attachment');
+ if ($requestInterface->getMethod() === 'GET') {
+ $path = $requestInterface->getPath();
+ if ($this->server->tree->nodeExists($path)) {
+ $node = $this->server->tree->getNodeForPath($path);
+ if (($node instanceof IFile)) {
+ $responseInterface->addHeader('Content-Disposition', 'attachment');
+ }
}
+ }
});
// wait with registering these until auth is handled and the filesystem is setup