]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1544304 - Wrong escaping of quotes in attachment titles.
authorKohei Yoshino <kohei.yoshino@gmail.com>
Sun, 14 Apr 2019 22:30:57 +0000 (18:30 -0400)
committerGitHub <noreply@github.com>
Sun, 14 Apr 2019 22:30:57 +0000 (18:30 -0400)
extensions/BugModal/web/comments.js
extensions/FlagTypeComment/web/js/ftc.js

index ed9c91bf790c05b950a6060d45d44bed6977b9c2..39607fbf10d5658e81b451cc52a19ab1e08fc484 100644 (file)
@@ -569,7 +569,7 @@ Bugzilla.BugModal.Comments = class Comments {
     // Show image smaller than 2 MB
     if (type.match(/^image\/(?!vnd).+$/) && size < max_size) {
       $att.insertAdjacentHTML('beforeend', `
-        <a href="${link}" class="outer lightbox"><img src="${link}" alt="${name}" itemprop="image"></a>`);
+        <a href="${link}" class="outer lightbox"><img src="${link}" alt="${name.htmlEncode()}" itemprop="image"></a>`);
 
       // Add lightbox support
       $att.querySelector('.outer.lightbox').addEventListener('click', event => {
@@ -610,7 +610,7 @@ Bugzilla.BugModal.Comments = class Comments {
         const lang = is_patch ? 'diff' : type.match(/\w+$/)[0];
 
         $att.insertAdjacentHTML('beforeend', `
-          <button type="button" role="link" title="${name}" class="outer">
+          <button type="button" role="link" title="${name.htmlEncode()}" class="outer">
           <pre class="language-${lang}" role="img" itemprop="text">${text.htmlEncode()}</pre></button>`);
 
         // Make the button work as a link. It cannot be `<a>` because Prism Autolinker plugin may add links to `<pre>`
index a6736707c22fb17769eaddecaa428ecd821cd0c8..1b8b754d288e095de65b868502c738019f61590c 100644 (file)
@@ -198,12 +198,15 @@ Bugzilla.FlagTypeComment = class FlagTypeComment {
             (att.is_patch || this.extra_patch_types.includes(att.content_type)));
 
           if (others.length) {
-            $fieldset.querySelector('tbody').insertAdjacentHTML('beforeend',
-              '<tr class="other-patches"><th>Do you want to request approval of these patches as well?</th><td>' +
-              `${others.map(patch =>
-                `<div><label><input type="checkbox" checked data-id="${patch.id}"> ${patch.summary}</label></div>`
-              ).join('')}` +
-              '</td></tr>');
+            $fieldset.querySelector('tbody').insertAdjacentHTML('beforeend', `
+              <tr class="other-patches"><th>Do you want to request approval of these patches as well?</th><td>
+              ${others.map(patch => `
+                <div>
+                  <label><input type="checkbox" checked data-id="${patch.id}"> ${patch.summary.htmlEncode()}</label>
+                </div>
+              `).join('')}
+              </td></tr>
+            `);
           }
         });
       }