summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-08-14 20:11:35 +0200
committerGitHub <noreply@github.com>2019-08-14 20:11:35 +0200
commitc6e46794709c048409bd0f92415ff15b788e89c4 (patch)
tree9058a049f5e41216654b34287c1fd702f702eb80
parentd013ff6cae7e01f5a7e3003cde064854922297b4 (diff)
parentfea04ef2df39209e84c50a77bd7a24ffc3ab26bb (diff)
downloadnextcloud-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.php5
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