[Pkg-owncloud-commits] [php-sabredav] 06/33: Fixes issue 19.
David Prévot
taffit at moszumanska.debian.org
Sat Nov 30 15:43:54 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to tag version-1.0.10
in repository php-sabredav.
commit 050b19cd0a5d9a37021c1bc6461721b8e105ebc9
Author: Evert Pot <evert at rooftopsolutions.nl>
Date: Wed Feb 24 03:16:42 2010 +0000
Fixes issue 19.
---
ChangeLog | 3 +++
lib/Sabre/DAV/Server.php | 28 +++++++++++++++++-----------
tests/Sabre/DAV/ServerSimpleTest.php | 6 +-----
3 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c2ef2b7..7f12adf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+1.0.7-stable (2010-02-24)
+ * Fixed: Issue 19 regression for MS Office
+
1.0.6-stable (2010-02-23)
* Fixed: Issue 19: HEAD requests on Collections
diff --git a/lib/Sabre/DAV/Server.php b/lib/Sabre/DAV/Server.php
index 80c7fab..af31b38 100644
--- a/lib/Sabre/DAV/Server.php
+++ b/lib/Sabre/DAV/Server.php
@@ -371,22 +371,28 @@ class Sabre_DAV_Server {
$node = $this->tree->getNodeForPath($this->getRequestUri());
- if (!($node instanceof Sabre_DAV_IFile)) throw new Sabre_DAV_Exception_NotImplemented('HEAD is only implemented on File objects');
+ /* This information is only collection for File objects.
+ * Ideally we want to throw 405 Method Not Allowed for every
+ * non-file, but MS Office does not like this
+ */
+ if ($node instanceof Sabre_DAV_IFile) {
+ if ($size = $node->getSize())
+ $this->httpResponse->setHeader('Content-Length',$size);
- if ($size = $node->getSize())
- $this->httpResponse->setHeader('Content-Length',$size);
+ if ($etag = $node->getETag()) {
- if ($etag = $node->getETag()) {
+ $this->httpResponse->setHeader('ETag',$etag);
- $this->httpResponse->setHeader('ETag',$etag);
+ }
- }
+ if (!$contentType = $node->getContentType())
+ $contentType = 'application/octet-stream';
- if (!$contentType = $node->getContentType())
- $contentType = 'application/octet-stream';
-
- $this->httpResponse->setHeader('Content-Type', $contentType);
- $this->httpResponse->setHeader('Last-Modified', date(DateTime::RFC1123, $node->getLastModified()));
+ $this->httpResponse->setHeader('Content-Type', $contentType);
+ if ($lastMod = $node->getLastModified()) {
+ $this->httpResponse->setHeader('Last-Modified', date(DateTime::RFC1123, $node->getLastModified()));
+ }
+ }
$this->httpResponse->sendStatus(200);
}
diff --git a/tests/Sabre/DAV/ServerSimpleTest.php b/tests/Sabre/DAV/ServerSimpleTest.php
index c6b7af6..1030665 100644
--- a/tests/Sabre/DAV/ServerSimpleTest.php
+++ b/tests/Sabre/DAV/ServerSimpleTest.php
@@ -304,11 +304,7 @@ class Sabre_DAV_ServerSimpleTest extends Sabre_DAV_AbstractServer{
$this->server->httpRequest = ($request);
$this->server->exec();
- $this->assertEquals(array(
- 'Content-Type' => 'application/xml; charset=utf-8',
- ),$this->response->headers);
-
- $this->assertEquals('HTTP/1.1 501 Not Implemented',$this->response->status);
+ $this->assertEquals('HTTP/1.1 200 Ok',$this->response->status);
}
--
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