Skip to content
Snippets Groups Projects
Commit 3d419e87 authored by Jonathan Rose's avatar Jonathan Rose
Browse files

func_uri: URIENCODE/URIDECODE - allow empty strings as argument

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/
........

Merged revisions 418641 from http://svn.asterisk.org/svn/asterisk/branches/1.8


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@418649 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 148b8d12
No related branches found
No related tags found
No related merge requests found
...@@ -76,8 +76,8 @@ static int uriencode(struct ast_channel *chan, const char *cmd, char *data, ...@@ -76,8 +76,8 @@ static int uriencode(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len) char *buf, size_t len)
{ {
if (ast_strlen_zero(data)) { if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Syntax: URIENCODE(<data>) - missing argument!\n"); buf[0] = '\0';
return -1; return 0;
} }
ast_uri_encode(data, buf, len, ast_uri_http); ast_uri_encode(data, buf, len, ast_uri_http);
...@@ -90,8 +90,8 @@ static int uridecode(struct ast_channel *chan, const char *cmd, char *data, ...@@ -90,8 +90,8 @@ static int uridecode(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len) char *buf, size_t len)
{ {
if (ast_strlen_zero(data)) { if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Syntax: URIDECODE(<data>) - missing argument!\n"); buf[0] = '\0';
return -1; return 0;
} }
ast_copy_string(buf, data, len); ast_copy_string(buf, data, len);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment