[Pkg-owncloud-commits] [owncloud] 115/145: Test if $url is already prefixed by '/'

David Prévot taffit at moszumanska.debian.org
Wed Feb 26 16:27:47 UTC 2014


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

taffit pushed a commit to branch master
in repository owncloud.

commit 91b40457917d74a95e08ac75d98e652350f750ae
Author: Thomas Tanghus <thomas at tanghus.net>
Date:   Fri Feb 7 17:39:19 2014 +0100

    Test if $url is already prefixed by '/'
---
 lib/private/urlgenerator.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/private/urlgenerator.php b/lib/private/urlgenerator.php
index 7ed44c4..13f4cdf 100644
--- a/lib/private/urlgenerator.php
+++ b/lib/private/urlgenerator.php
@@ -124,6 +124,7 @@ class URLGenerator implements IURLGenerator {
 	 * @return string the absolute version of the url
 	 */
 	public function getAbsoluteURL($url) {
-		return \OC_Request::serverProtocol() . '://' . \OC_Request::serverHost() . '/' . $url;
+		$separator = $url[0] === '/' ? '' : '/';
+		return \OC_Request::serverProtocol() . '://' . \OC_Request::serverHost() . $separator . $url;
 	}
 }

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



More information about the Pkg-owncloud-commits mailing list