Test if $url is already prefixed by '/'

This commit is contained in:
Thomas Tanghus 2014-02-07 17:39:19 +01:00 committed by Bjoern Schiessle
parent 0f87a0248f
commit 91b4045791
1 changed files with 2 additions and 1 deletions

View File

@ -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;
}
}