[Pkg-owncloud-commits] [php-sabredav] 138/275: Exception when doing addressbook-query on non-card.

David Prévot taffit at moszumanska.debian.org
Thu Sep 25 14:56:01 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 1e181bcfa262392b7aa334dbf76357143cdc0d0c
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Fri Aug 8 19:12:44 2014 -0400

    Exception when doing addressbook-query on non-card.
    
    VObject 3.3.0
---
 ChangeLog.md           | 3 +++
 composer.json          | 2 +-
 lib/CardDAV/Plugin.php | 7 +++++--
 tests/phpunit.xml      | 4 ++--
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index 3d65bdf..086650a 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -14,6 +14,9 @@ ChangeLog
   (@aklomp)
 * #486: It's now possible to return additional properties when an 'allprop'
   PROPFIND request is being done. (@aklomp)
+* Changed: Now return HTTP errors when an addressbook-query REPORT is done
+  on a uri that's not a vcard. This should help with debugging this common
+  mistake.
 
 2.0.4 (????-??-??)
 ------------------
diff --git a/composer.json b/composer.json
index 879e940..e82b5e6 100644
--- a/composer.json
+++ b/composer.json
@@ -15,7 +15,7 @@
     ],
     "require": {
         "php": ">=5.4.1",
-        "sabre/vobject" : "~3.2.0",
+        "sabre/vobject" : "~3.3.0",
         "sabre/event" : "~2.0.0",
         "sabre/http" : "~2.0.3",
         "ext-dom": "*",
diff --git a/lib/CardDAV/Plugin.php b/lib/CardDAV/Plugin.php
index 47eb870..4070205 100644
--- a/lib/CardDAV/Plugin.php
+++ b/lib/CardDAV/Plugin.php
@@ -397,9 +397,12 @@ class Plugin extends DAV\ServerPlugin {
         $depth = $this->server->getHTTPDepth(0);
 
         if ($depth==0) {
-            $candidateNodes = array(
+            $candidateNodes = [
                 $this->server->tree->getNodeForPath($this->server->getRequestUri())
-            );
+            ];
+            if (!$candidateNodes[0] instanceof ICard) {
+                throw new ReportNotSupported('The addressbook-query report is not supported on this url with Depth: 0');
+            }
         } else {
             $candidateNodes = $this->server->tree->getChildren($this->server->getRequestUri());
         }
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
index ba4b3e1..43bf922 100644
--- a/tests/phpunit.xml
+++ b/tests/phpunit.xml
@@ -7,10 +7,10 @@
   strict="true"
   >
   <testsuite name="sabre-vobject">
-      <directory>../vendor/sabre/vobject/tests/Sabre/VObject</directory>
+      <directory>../vendor/sabre/vobject/tests/VObject</directory>
   </testsuite>
   <testsuite name="sabre-event">
-      <directory>../vendor/sabre/event/tests/Sabre/Event</directory>
+      <directory>../vendor/sabre/event/tests/</directory>
   </testsuite>
   <testsuite name="sabre-http">
       <directory>../vendor/sabre/http/tests/Sabre/HTTP</directory>

-- 
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