Browse Source

repair getting rid of warnings

Chris Vogel 1 năm trước cách đây
mục cha
commit
e45aa5de8a
1 tập tin đã thay đổi với 15 bổ sung8 xóa
  1. 15 8
      scripts/_common.sh

+ 15 - 8
scripts/_common.sh

@@ -429,27 +429,34 @@ flohmarkt_ynh_local_curl() {
       ynh_die --message="method $method not supported by flohmarkt_ynh_local_curl"
       ynh_die --message="method $method not supported by flohmarkt_ynh_local_curl"
     fi
     fi
 
 
-    # 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}"
+    # 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
         fi
-    fi
+    }
 
 
     # Define url of page to curl
     # Define url of page to curl
     # $location contains either an URL or just a page
     # $location contains either an URL or just a page
     local full_page_url
     local full_page_url
+    echo "################### location='$location' ###################"
     if [[ "$location" =~ ^https?:// ]]; then
     if [[ "$location" =~ ^https?:// ]]; then
         # if $location starts with an http-protocol use value as a complete URL
         # if $location starts with an http-protocol use value as a complete URL
         full_page_url="$location"
         full_page_url="$location"
     elif [ "${path_url}" == "/" ]; then
     elif [ "${path_url}" == "/" ]; then
         # if $path_url points to the webserver root just append $location to localhost URL
         # if $path_url points to the webserver root just append $location to localhost URL
+        flohmarkt_normalize_url_path
         full_page_url="https://localhost${location}"
         full_page_url="https://localhost${location}"
     else
     else
         # else append $path_url and $location to localhost URL
         # else append $path_url and $location to localhost URL
+        flohmarkt_normalize_url_path
         full_page_url="https://localhost${path_url}${location}"
         full_page_url="https://localhost${path_url}${location}"
     fi
     fi
     flohmarkt_print_debug "full_page_url='$full_page_url'"
     flohmarkt_print_debug "full_page_url='$full_page_url'"