[Pkg-owncloud-commits] [php-sabredav] 205/220: Use Sabre\Uri\resolve in DAV\Client. Fixes #759.

David Prévot taffit at moszumanska.debian.org
Thu May 12 01:21:28 UTC 2016


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

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

commit bc3af89037e5645d63bbb04498d55900ac8144eb
Author: Evert Pot <me at evertpot.com>
Date:   Fri Apr 29 14:22:31 2016 +0700

    Use Sabre\Uri\resolve in DAV\Client. Fixes #759.
---
 CHANGELOG.md       |  1 +
 lib/DAV/Client.php | 19 +++++--------------
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0ce06db..ac38b2f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -52,6 +52,7 @@ ChangeLog
 * #599: Support for `acl-principal-prop-set` ACL `REPORT`.
 * #798: Added an index on `firstoccurence` field in MySQL CalDAV backend. This
   should speed up common calendar-query requests.
+* #759: DAV\Client is now able to actually correctly resolve relative urls.
 
 
 3.1.3 (2016-04-06)
diff --git a/lib/DAV/Client.php b/lib/DAV/Client.php
index d46b397..08d5d47 100644
--- a/lib/DAV/Client.php
+++ b/lib/DAV/Client.php
@@ -3,6 +3,7 @@
 namespace Sabre\DAV;
 
 use Sabre\HTTP;
+use Sabre\Uri;
 
 /**
  * SabreDAV DAV client
@@ -387,20 +388,10 @@ class Client extends HTTP\Client {
      */
     function getAbsoluteUrl($url) {
 
-        // If the url starts with http:// or https://, the url is already absolute.
-        if (preg_match('/^http(s?):\/\//', $url)) {
-            return $url;
-        }
-
-        // If the url starts with a slash, we must calculate the url based off
-        // the root of the base url.
-        if (strpos($url, '/') === 0) {
-            $parts = parse_url($this->baseUri);
-            return $parts['scheme'] . '://' . $parts['host'] . (isset($parts['port']) ? ':' . $parts['port'] : '') . $url;
-        }
-
-        // Otherwise...
-        return $this->baseUri . $url;
+        return Uri\resolve(
+            $this->baseUri,
+            $url
+        );
 
     }
 

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



More information about the Pkg-owncloud-commits mailing list