From ab4b0f7e8c85ec4821fc08a1a311fd4267c4d4c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sat, 5 May 2018 11:51:14 +0200 Subject: [PATCH] sanitize path --- scripts/install | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/install b/scripts/install index 4675365..f4469ec 100644 --- a/scripts/install +++ b/scripts/install @@ -34,6 +34,16 @@ workdir=$(pwd) # find suitable port (default 3000) port=$(ynh_find_port 3000) +# if path do not begin with / add a / at the begining +if [ "${path:0:1}" != "/" ]; then + path="/$path" +fi +# if path do not end with / add a / at the end +if [ "${path:${#path}-1}" != "/" ] && [ ${#path} -gt 1 ]; then + path="$path/" +fi + + # Check domain/path availability ynh_webpath_available $domain $path if [[ ! $? -eq 0 ]]; then