From 6555ee359ca84129595fc8b98b9bbb3d3339060a Mon Sep 17 00:00:00 2001 From: Kayou Date: Sun, 10 Feb 2019 00:08:12 +0100 Subject: [PATCH] Small fix on ynh_url_join --- scripts/_common.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 09ff695..a025c0b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -41,6 +41,15 @@ ynh_local_curl () { curl --silent --show-error -kL -H "Host: $domain" --resolve $domain:443:127.0.0.1 $POST_data "$full_page_url" } +# Join several urls together +# Return a concatenate normalized url path +# +# example: url_path=$(ynh_url_join $url_path /admin /index.php) +# ynh_url_join example admin index.php -> /example/admin/index.php +# ynh_url_join /example admin /index.php -> /example/admin/index.php +# ynh_url_join / -> / +# +# usage: ynh_url_join url1 url2 ... ynh_url_join() { if [ "$#" -eq 0 ]; then ynh_die "Illegal number of parameters" @@ -60,6 +69,6 @@ ynh_url_join() { full_url=${full_url}${var} done - full_url=$(ynh_normalize_url_path $full_url) + full_url=$(ynh_normalize_url_path ${full_url:-'/'}) echo $full_url } \ No newline at end of file