<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19316">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span></span><br></pre><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">say: Don't prepend ampersand erroneously.<br><br>Some logic in say.c for determining if we need<br>to also add an ampersand for file seperation was faulty,<br>as non-successful files would increment the count, causing<br>a leading ampersand to be added improperly.<br><br>This is fixed, and a unit test that captures this regression<br>is also added.<br><br>ASTERISK-30248 #close<br><br>Change-Id: I02c1d3a11d82fe4ea8b462070cbd1effb5834d2b<br>---<br>M funcs/func_sayfiles.c<br>M main/say.c<br>2 files changed, 31 insertions(+), 3 deletions(-)<br><br></pre>
<pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/funcs/func_sayfiles.c b/funcs/func_sayfiles.c</span><br><span>index d3f3341..7e0ece2 100644</span><br><span>--- a/funcs/func_sayfiles.c</span><br><span>+++ b/funcs/func_sayfiles.c</span><br><span>@@ -211,6 +211,15 @@</span><br><span> res = AST_TEST_FAIL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ /* + should be ignored and there should not be a leading & */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_str_set(&expr, 0, "${SAYFILES(+18005551212,digits)}");</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_str_substitute_variables(&result, 0, NULL, ast_str_buffer(expr));</span><br><span style="color: hsl(120, 100%, 40%);">+ if (strcmp(ast_str_buffer(result), "digits/1&digits/8&digits/0&digits/0&digits/5&digits/5&digits/5&digits/1&digits/2&digits/1&digits/2") != 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_test_status_update(test, "SAYFILES(+18005551212,digits) test failed ('%s')\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_str_buffer(result));</span><br><span style="color: hsl(120, 100%, 40%);">+ res = AST_TEST_FAIL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> ast_str_set(&expr, 0, "${SAYFILES(35,number)}");</span><br><span> ast_str_substitute_variables(&result, 0, NULL, ast_str_buffer(expr));</span><br><span> if (strcmp(ast_str_buffer(result), "digits/30&digits/5") != 0) {</span><br><span>diff --git a/main/say.c b/main/say.c</span><br><span>index b60d4bf..14e43df 100644</span><br><span>--- a/main/say.c</span><br><span>+++ b/main/say.c</span><br><span>@@ -160,7 +160,7 @@</span><br><span> }</span><br><span> if ((fn && ast_fileexists(fn, NULL, lang) > 0) ||</span><br><span> (snprintf(asciibuf + 13, sizeof(asciibuf) - 13, "%d", str[num]) > 0 && ast_fileexists(asciibuf, NULL, lang) > 0 && (fn = asciibuf))) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_str_append(&filenames, 0, (num == 0 ? "%s" : "&%s"), fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_str_append(&filenames, 0, "%s%s", ast_str_strlen(filenames) ? "&" : "", fn);</span><br><span> }</span><br><span> if (upper || lower) {</span><br><span> continue;</span><br><span>@@ -282,7 +282,7 @@</span><br><span> fn = fnbuf;</span><br><span> }</span><br><span> if (fn && ast_fileexists(fn, NULL, lang) > 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_str_append(&filenames, 0, (num == 0 ? "%s" : "&%s"), fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_str_append(&filenames, 0, "%s%s", ast_str_strlen(filenames) ? "&" : "", fn);</span><br><span> }</span><br><span> num++;</span><br><span> }</span><br><span>@@ -336,7 +336,7 @@</span><br><span> break;</span><br><span> }</span><br><span> if (fn && ast_fileexists(fn, NULL, lang) > 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_str_append(&filenames, 0, (num == 0 ? "%s" : "&%s"), fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_str_append(&filenames, 0, "%s%s", ast_str_strlen(filenames) ? "&" : "", fn);</span><br><span> }</span><br><span> num++;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19316">change 19316</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/19316"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I02c1d3a11d82fe4ea8b462070cbd1effb5834d2b </div>
<div style="display:none"> Gerrit-Change-Number: 19316 </div>
<div style="display:none"> Gerrit-PatchSet: 5 </div>
<div style="display:none"> Gerrit-Owner: N A <asterisk@phreaknet.org> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean@seanbright.com> </div>
<div style="display:none"> Gerrit-CC: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>