diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-08-14 20:11:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-14 20:11:35 +0200 |
commit | c6e46794709c048409bd0f92415ff15b788e89c4 (patch) | |
tree | 9058a049f5e41216654b34287c1fd702f702eb80 | |
parent | d013ff6cae7e01f5a7e3003cde064854922297b4 (diff) | |
parent | fea04ef2df39209e84c50a77bd7a24ffc3ab26bb (diff) | |
download | nextcloud-server-c6e46794709c048409bd0f92415ff15b788e89c4.tar.gz nextcloud-server-c6e46794709c048409bd0f92415ff15b788e89c4.zip |
Merge pull request #16739 from nextcloud/office/head
Fix opening office documents from webdav network mounts on windows
-rw-r--r-- | apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php index 67c1a9a5118..63a5da96b73 100644 --- a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php @@ -57,7 +57,10 @@ class AnonymousOptionsPlugin extends ServerPlugin { * @return bool */ public function handleAnonymousOptions(RequestInterface $request, ResponseInterface $response) { - if ($request->getHeader('Authorization') === null && $request->getMethod() === 'OPTIONS' && $this->isRequestInRoot($request->getPath())) { + $isOffice = preg_match('/Microsoft Office/i', $request->getHeader('User-Agent')); + $isAnonymousOption = ($request->getMethod() === 'OPTIONS' && ($request->getHeader('Authorization') === null || trim($request->getHeader('Authorization')) === 'Bearer') && $this->isRequestInRoot($request->getPath())); + $isOfficeHead = $request->getMethod() === 'HEAD' && $isOffice && $request->getHeader('Authorization') === 'Bearer'; + if ($isAnonymousOption || $isOfficeHead) { /** @var CorePlugin $corePlugin */ $corePlugin = $this->server->getPlugin('core'); // setup a fake tree for anonymous access |