diff options
author | Christian Hesse <mail@eworm.de> | 2018-10-12 14:07:47 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2018-10-12 14:07:47 +0200 |
commit | c9175d8e5e9a4fa56c21013223ddbceb5d7acbaa (patch) | |
tree | 21c9b5002b4fc28c68ab61c1e40d082d1b004c6a /global-functions | |
parent | 7b0b808c1838924e0b38f6aa216ee8e711d4196c (diff) |
global-functions: make sure parameters are strings
Diffstat (limited to 'global-functions')
-rw-r--r-- | global-functions | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/global-functions b/global-functions index 3ad0d18..d0494c4 100644 --- a/global-functions +++ b/global-functions @@ -6,14 +6,15 @@ # url encoding :global UrlEncode do={ + :local input [ :tostr $1 ]; :local return ""; - :if ([ :len $1 ] > 0) do={ + :if ([ :len $input ] > 0) do={ :local chars " %&"; :local subs { "%20"; "%25"; "%26" }; - :for i from=0 to=([ :len $1 ] - 1) do={ - :local char [ :pick $1 $i ]; + :for i from=0 to=([ :len $input ] - 1) do={ + :local char [ :pick $input $i ]; :local replace [ :find $chars $char ]; :if ([ :len $replace ] > 0) do={ @@ -29,9 +30,9 @@ # send notification via e-mail and telegram # Note that subject and attachment are ignored for telegram! :global SendNotification do={ - :local subject $1; - :local message $2; - :local attach $3; + :local subject [ :tostr $1 ]; + :local message [ :tostr $2 ]; + :local attach [ :tostr $3 ]; :global "email-general-to"; :global "email-general-cc"; |