1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/flohmarkt_ynh.git synced 2024-09-03 18:36:30 +02:00

repair getting rid of warnings

This commit is contained in:
Chris Vogel 2024-06-12 18:17:18 +02:00
parent e9f1a5f245
commit e45aa5de8a

View file

@ -429,27 +429,34 @@ flohmarkt_ynh_local_curl() {
ynh_die --message="method $method not supported by flohmarkt_ynh_local_curl"
fi
# check that $location is a valid '/path'
if [[ -n "${location}" ]]; then
if [ "${location:0:1}" != "/" ]; then
location="/${location}"
# linter doesn't want that the internal function is used anymore
# it's replaced here quick and dirty
flohmarkt_normalize_url_path() {
# check that $location is a valid '/path'
if [[ -n "${location}" ]]; then
if [ "${location:0:1}" != "/" ]; then
location="/${location}"
fi
if [ "${location:${#location}-1}" == "/" ]; then
location="${location:0:${#location}-1}"
fi
fi
if [ "${location:${#location}-1}" == "/" ]; then
location="${location:0:${#location}-1}"
fi
fi
}
# Define url of page to curl
# $location contains either an URL or just a page
local full_page_url
echo "################### location='$location' ###################"
if [[ "$location" =~ ^https?:// ]]; then
# if $location starts with an http-protocol use value as a complete URL
full_page_url="$location"
elif [ "${path_url}" == "/" ]; then
# if $path_url points to the webserver root just append $location to localhost URL
flohmarkt_normalize_url_path
full_page_url="https://localhost${location}"
else
# else append $path_url and $location to localhost URL
flohmarkt_normalize_url_path
full_page_url="https://localhost${path_url}${location}"
fi
flohmarkt_print_debug "full_page_url='$full_page_url'"