From f119769c2683ae55aee440e6188933c7b59998cd Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind@owncloud.com>
Date: Wed, 1 Jun 2016 14:51:25 +0200
Subject: [PATCH] Better handling of forbidden files in dav

---
 apps/dav/lib/Connector/Sabre/Directory.php  | 2 ++
 apps/dav/lib/Connector/Sabre/ObjectTree.php | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php
index e7226b58196..ddab34605f3 100644
--- a/apps/dav/lib/Connector/Sabre/Directory.php
+++ b/apps/dav/lib/Connector/Sabre/Directory.php
@@ -196,6 +196,8 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node
 				throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
 			} catch (\OCP\Files\InvalidPathException $ex) {
 				throw new InvalidPath($ex->getMessage());
+			} catch (ForbiddenException $e) {
+				throw new \Sabre\DAV\Exception\Forbidden();
 			}
 		}
 
diff --git a/apps/dav/lib/Connector/Sabre/ObjectTree.php b/apps/dav/lib/Connector/Sabre/ObjectTree.php
index 599f3fdfd0e..9e7d876187d 100644
--- a/apps/dav/lib/Connector/Sabre/ObjectTree.php
+++ b/apps/dav/lib/Connector/Sabre/ObjectTree.php
@@ -161,6 +161,8 @@ class ObjectTree extends \Sabre\DAV\Tree {
 				throw new \Sabre\DAV\Exception\NotFound('Storage ' . $path . ' is invalid');
 			} catch (LockedException $e) {
 				throw new \Sabre\DAV\Exception\Locked();
+			} catch (ForbiddenException $e) {
+				throw new \Sabre\DAV\Exception\Forbidden();
 			}
 		}
 
-- 
GitLab