diff options
author | Lukas Reschke <lukas@owncloud.com> | 2016-02-23 11:54:22 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2016-02-23 12:23:41 +0100 |
commit | fc2c5fe41420c2c43c6718a5a2e287afde5bdf49 (patch) | |
tree | 6a9a398c3ba30ace50bfe65d9143764bfecb29ce /apps | |
parent | 59acc53483bd7c61285fa2495992836c3e00e74b (diff) | |
download | nextcloud-server-fc2c5fe41420c2c43c6718a5a2e287afde5bdf49.tar.gz nextcloud-server-fc2c5fe41420c2c43c6718a5a2e287afde5bdf49.zip |
Add header for attachment disposition only once
Recent refactorings have resulted in the header being added twice, this makes browsers ignore the header which removes any security gains.
This changeset adds the header only once and adds integration tests ensuring the correct header in future.
https://github.com/owncloud/core/issues/22577
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/server.php | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/apps/dav/lib/server.php b/apps/dav/lib/server.php index 74be318fe5e..377f76fd501 100644 --- a/apps/dav/lib/server.php +++ b/apps/dav/lib/server.php @@ -114,19 +114,6 @@ class Server { $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\FakeLockerPlugin()); } - // Serve all files with an Content-Disposition of type "attachment" - $this->server->on('beforeMethod', function (RequestInterface $requestInterface, ResponseInterface $responseInterface) { - 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 $this->server->on('beforeMethod', function () { // custom properties plugin must be the last one |