commit 11ed4e455eb9b3ebf3c26aa2630653a7caf1e3d0
parent 536462adfa24bfbe2d7e320848638e56441935d5
Author: Florian Dold <florian.dold@gmail.com>
Date: Mon, 25 Jan 2016 16:21:09 +0100
fix url helper
Diffstat:
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/frontend_lib/util.php b/src/frontend_lib/util.php
@@ -5,12 +5,10 @@ function get(&$var, $default=null) {
}
function url_join($base, $path, $strip=false) {
- $url = new http\URL($base);
- if ($strip === true) {
- $url = $url->mod(null, http\Url::STRIP_QUERY|http\Url::STRIP_FRAGMENT);
- }
- $url = $url->mod(array ("path" => $path), http\Url::JOIN_PATH|http\URL::SANITIZE_PATH);
- return $url->toString();
+ $flags = strip ? (http\Url::JOIN_PATH|http\URL::SANITIZE_PATH) : 0;
+ return (new http\URL($base, null, flags))
+ ->mod(array ("path" => $path), http\Url::JOIN_PATH|http\URL::SANITIZE_PATH)
+ ->toString();
}
// Get a url with a path relative to the