mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-01 05:14:04 +02:00
URI encode
This commit is contained in:
@@ -166,11 +166,31 @@ check_vector_extension() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
url_encode() {
|
||||||
|
local string="${1}"
|
||||||
|
local length="${#string}"
|
||||||
|
local encoded=""
|
||||||
|
for (( i = 0; i < length; i++ )); do
|
||||||
|
local c="${string:i:1}"
|
||||||
|
case $c in
|
||||||
|
[a-zA-Z0-9.~_-])
|
||||||
|
encoded+="$c"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf -v hex '%%%02X' "'$c"
|
||||||
|
encoded+="${hex}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
echo "${encoded}"
|
||||||
|
}
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
# Main script execution #
|
# Main script execution #
|
||||||
#########################
|
#########################
|
||||||
|
|
||||||
export_options
|
export_options
|
||||||
|
DB_PASSWORD="$(url_encode "${DB_PASSWORD}")"
|
||||||
check_db_hostname
|
check_db_hostname
|
||||||
migrate_database
|
migrate_database
|
||||||
validate_config
|
validate_config
|
||||||
|
|||||||
Reference in New Issue
Block a user