<p>George Joseph <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19813">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:
George Joseph: Looks good to me, approved; 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>(cherry picked from commit bf6194be45acb277cd69e6236050c77880ccb2af)<br>---<br>M funcs/func_sayfiles.c<br>M main/say.c<br>2 files changed, 32 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 28fe944..16e5c14 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/+/19813">change 19813</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/+/19813"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16.30 </div>
<div style="display:none"> Gerrit-Change-Id: I02c1d3a11d82fe4ea8b462070cbd1effb5834d2b </div>
<div style="display:none"> Gerrit-Change-Number: 19813 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-CC: N A <asterisk@phreaknet.org> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>