]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
func_uri: URIENCODE/URIDECODE - allow empty strings as argument
authorJonathan Rose <jrose@digium.com>
Tue, 15 Jul 2014 17:19:52 +0000 (17:19 +0000)
committerJonathan Rose <jrose@digium.com>
Tue, 15 Jul 2014 17:19:52 +0000 (17:19 +0000)
Previously these two dialplan functions would issue warnings and
return failure when an empty string is used as the argument. Now
they will not issue a warning and will successfully return an
empty string.

ASTERISK-23911 #close
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/3745/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@418641 65c4cc65-6c06-0410-ace0-fbb531ad65f3

funcs/func_uri.c

index 93726355c4c7ddff20c13751e7ba4494e32653a4..557f84631d239bb891123cd51d3ea7255766d134 100644 (file)
@@ -76,8 +76,8 @@ static int uriencode(struct ast_channel *chan, const char *cmd, char *data,
                     char *buf, size_t len)
 {
        if (ast_strlen_zero(data)) {
-               ast_log(LOG_WARNING, "Syntax: URIENCODE(<data>) - missing argument!\n");
-               return -1;
+               buf[0] = '\0';
+               return 0;
        }
 
        ast_uri_encode(data, buf, len, 1);
@@ -90,8 +90,8 @@ static int uridecode(struct ast_channel *chan, const char *cmd, char *data,
                     char *buf, size_t len)
 {
        if (ast_strlen_zero(data)) {
-               ast_log(LOG_WARNING, "Syntax: URIDECODE(<data>) - missing argument!\n");
-               return -1;
+               buf[0] = '\0';
+               return 0;
        }
 
        ast_copy_string(buf, data, len);