[Pkg-owncloud-commits] [php-sabredav] 54/66: adding configuration parameter to enable depth infinity support

David Prévot taffit at moszumanska.debian.org
Sat Jan 18 20:08:22 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabredav.

commit a381bb7097f2ca541662396669b05c84ac991915
Author: Thomas Müller <thomas.mueller at tmit.eu>
Date:   Fri Jan 10 00:20:35 2014 +0100

    adding configuration parameter to enable depth infinity support
---
 lib/Sabre/DAV/CorePlugin.php | 2 ++
 lib/Sabre/DAV/Server.php     | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/Sabre/DAV/CorePlugin.php b/lib/Sabre/DAV/CorePlugin.php
index ffb1d5f..385b980 100644
--- a/lib/Sabre/DAV/CorePlugin.php
+++ b/lib/Sabre/DAV/CorePlugin.php
@@ -316,6 +316,8 @@ class CorePlugin extends ServerPlugin {
         );
 
         $depth = $this->server->getHTTPDepth(1);
+	    // The only two options for the depth of a propfind is 0 or 1
+	    if (!$this->server->enablePropfindDepthInfinity && $depth != 0) $depth = 1;
 
         $newProperties = $this->server->getPropertiesForPath($path,$requestedProperties,$depth);
 
diff --git a/lib/Sabre/DAV/Server.php b/lib/Sabre/DAV/Server.php
index c8e4e20..a6b5a82 100644
--- a/lib/Sabre/DAV/Server.php
+++ b/lib/Sabre/DAV/Server.php
@@ -165,6 +165,8 @@ class Server extends EventEmitter {
         'Sabre\\DAV\\ICollection' => '{DAV:}collection',
     ];
 
+	public $enablePropfindDepthInfinity = false;
+
     /**
      * If this setting is turned off, SabreDAV's version number will be hidden
      * from various places.
@@ -871,7 +873,9 @@ class Server extends EventEmitter {
      */
     public function getPropertiesForPath($path, $propertyNames = [], $depth = 0) {
 
-        $path = rtrim($path,'/');
+	    if (!$this->enablePropfindDepthInfinity && $depth != 0) $depth = 1;
+
+	    $path = rtrim($path,'/');
 
         // This event allows people to intercept these requests early on in the
         // process.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git



More information about the Pkg-owncloud-commits mailing list