[Pkg-owncloud-commits] [php-sabredav] 13/24: Fix for ticket #393.
David Prévot
taffit at moszumanska.debian.org
Tue May 20 17:19:42 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 8542b5c64c3ac8c814a2e4b4c7aafb8eb51bdc47
Author: Evert Pot <evert at rooftopsolutions.nl>
Date: Tue Apr 15 00:29:16 2014 -0400
Fix for ticket #393.
---
ChangeLog | 2 ++
lib/Sabre/DAV/PartialUpdate/Plugin.php | 2 +-
tests/Sabre/DAV/PartialUpdate/PluginTest.php | 20 ++++++++++++++++++++
3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index e75deb9..df5c4d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,8 @@
* Fixed: Issue #427: Now checking preconditions on DELETE requests.
* Fixed: Issue #428: Etag check with If: fails if the target is a
collection.
+ * Fixed: Issue #393: PATCH request with missing end-range was handled
+ incorrectly.
1.7.11-stable (2014-02-26)
* The zip release ships with sabre/vobject 2.1.3.
diff --git a/lib/Sabre/DAV/PartialUpdate/Plugin.php b/lib/Sabre/DAV/PartialUpdate/Plugin.php
index ff59400..3509e5c 100644
--- a/lib/Sabre/DAV/PartialUpdate/Plugin.php
+++ b/lib/Sabre/DAV/PartialUpdate/Plugin.php
@@ -148,7 +148,7 @@ class Sabre_DAV_PartialUpdate_Plugin extends Sabre_DAV_ServerPlugin {
// Load the begin and end data
$start = ($range[0])?$range[0]:0;
- $end = ($range[1])?$range[1]:$len-1;
+ $end = ($range[1])?$range[1]:$start+$len-1;
// Check consistency
if($end < $start)
diff --git a/tests/Sabre/DAV/PartialUpdate/PluginTest.php b/tests/Sabre/DAV/PartialUpdate/PluginTest.php
index 6555f50..aa7d671 100644
--- a/tests/Sabre/DAV/PartialUpdate/PluginTest.php
+++ b/tests/Sabre/DAV/PartialUpdate/PluginTest.php
@@ -122,4 +122,24 @@ class Sabre_DAV_PartialUpdate_PluginTest extends Sabre_DAVServerTest {
}
+ public function testPatchNoEndRange() {
+
+ $this->node->put('00000');
+ $request = new Sabre_HTTP_Request(array(
+ 'REQUEST_METHOD' => 'PATCH',
+ 'REQUEST_URI' => '/partial',
+ 'HTTP_X_UPDATE_RANGE' => 'bytes=3-',
+ 'HTTP_CONTENT_TYPE' => 'application/x-sabredav-partialupdate',
+ 'HTTP_CONTENT_LENGTH' => 3,
+ ));
+ $request->setBody(
+ '111'
+ );
+ $response = $this->request($request);
+
+ $this->assertEquals('HTTP/1.1 204 No Content', $response->status, 'Full response body:' . $response->body);
+ $this->assertEquals('00111', $this->node->get());
+
+ }
+
}
--
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