<p>Nicholas John Koch has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14407">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_musiconhold: Added check for dot character in path of playlist entries to avoid warnings<br><br>A warning was triggered that there may be a problem regarding file<br>extension (which is correct and should not be set anyway). The warning<br>also appeared if there was dot within the path itself.<br><br>E.g.<br>[sales-queue-hold]<br>mode=playlist<br>entry=/var/www/domain.tld/moh/funky_music<br><br>The music played correctly but you get a warning message.<br><br>Now there will be a check if the position of a potential dot character<br>is after the last position of a slash character. This dot charachter<br>will be treated as a extension naming. Dots within the path then ignored.<br><br>ASTERISK-28892<br>Reported-By: Nicholas John Koch<br><br>Change-Id: I2ec35a613413affbf5fcc01c8c181eba24865b9e<br>---<br>M res/res_musiconhold.c<br>1 file changed, 10 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/07/14407/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c</span><br><span>index dd9b8a5..c2eb1ac 100644</span><br><span>--- a/res/res_musiconhold.c</span><br><span>+++ b/res/res_musiconhold.c</span><br><span>@@ -1087,9 +1087,16 @@</span><br><span>                                if (!dup) {</span><br><span>                                  continue;</span><br><span>                            }</span><br><span style="color: hsl(0, 100%, 40%);">-                               if (ast_begins_with(dup, "/") && strrchr(dup, '.')) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                 ast_log(LOG_WARNING, "The playlist entry '%s' may include an extension, which could prevent it from playing.\n",</span><br><span style="color: hsl(0, 100%, 40%);">-                                              dup);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                               if (ast_begins_with(dup, "/")) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                    char *last_pos_dot = strrchr(dup, '.');</span><br><span style="color: hsl(120, 100%, 40%);">+                                       char *last_pos_slash = strrchr(dup, '/');</span><br><span style="color: hsl(120, 100%, 40%);">+                                     if (last_pos_dot != NULL) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                           if ((int)(last_pos_dot - dup) > (int)(last_pos_slash - dup)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                                     ast_log(LOG_WARNING, "The playlist entry '%s' may include an extension, which could prevent it from playing.\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                                                            dup);</span><br><span style="color: hsl(120, 100%, 40%);">+                                         }</span><br><span style="color: hsl(120, 100%, 40%);">+                                     }</span><br><span>                            }</span><br><span>                            AST_VECTOR_APPEND(&mohclass->files, dup);</span><br><span>                     } else {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14407">change 14407</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/+/14407"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I2ec35a613413affbf5fcc01c8c181eba24865b9e </div>
<div style="display:none"> Gerrit-Change-Number: 14407 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Nicholas John Koch <koch@njk-it.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>