[Pkg-owncloud-commits] [php-sabredav] 10/24: Ensuring that If: with an etag does not error on a collection.
David Prévot
taffit at moszumanska.debian.org
Tue May 20 17:19:41 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch 1.7
in repository php-sabredav.
commit 1d7288a07d43ab7937288c83a001c55bda1e40d1
Author: Evert Pot <evert at rooftopsolutions.nl>
Date: Fri Apr 4 16:42:35 2014 -0400
Ensuring that If: with an etag does not error on a collection.
Issue #428
---
ChangeLog | 2 ++
lib/Sabre/DAV/Locks/Plugin.php | 2 +-
tests/Sabre/DAV/Locks/PluginTest.php | 16 ++++++++++++++++
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 251b05f..e75deb9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@
existant files. Not really a chance for data-loss, but incorrect
nevertheless.
* Fixed: Issue #427: Now checking preconditions on DELETE requests.
+ * Fixed: Issue #428: Etag check with If: fails if the target is a
+ collection.
1.7.11-stable (2014-02-26)
* The zip release ships with sabre/vobject 2.1.3.
diff --git a/lib/Sabre/DAV/Locks/Plugin.php b/lib/Sabre/DAV/Locks/Plugin.php
index ff724ea..56a78fc 100644
--- a/lib/Sabre/DAV/Locks/Plugin.php
+++ b/lib/Sabre/DAV/Locks/Plugin.php
@@ -501,7 +501,7 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
$uri = $conditionUri?$conditionUri:$this->server->getRequestUri();
$node = $this->server->tree->getNodeForPath($uri);
- $etagValid = $node->getETag()==$conditionToken[2];
+ $etagValid = $node instanceof Sabre_DAV_IFile && $node->getETag()==$conditionToken[2];
}
diff --git a/tests/Sabre/DAV/Locks/PluginTest.php b/tests/Sabre/DAV/Locks/PluginTest.php
index 758a492..55ced34 100644
--- a/tests/Sabre/DAV/Locks/PluginTest.php
+++ b/tests/Sabre/DAV/Locks/PluginTest.php
@@ -909,6 +909,22 @@ class Sabre_DAV_Locks_PluginTest extends Sabre_DAV_AbstractServer {
}
+ function testDeleteWithETagOnCollection() {
+
+ $serverVars = array(
+ 'REQUEST_URI' => '/dir',
+ 'REQUEST_METHOD' => 'DELETE',
+ 'HTTP_IF' => '(["etag1"])',
+ );
+
+ $request = new Sabre_HTTP_Request($serverVars);
+ $request->setBody('newbody');
+ $this->server->httpRequest = $request;
+ $this->server->exec();
+ $this->assertEquals('HTTP/1.1 412 Precondition failed',$this->response->status);
+
+ }
+
function testGetTimeoutHeader() {
$request = new Sabre_HTTP_Request(array(
--
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