You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2026/08/26 15:52:06 UTC

(allura) 04/06: [#8619] sanitize class/id on void elements too

This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch db/8619
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 241598ca5b64045fa1e297a5f35b5c770cb5c392
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Tue Aug 25 16:33:18 2026 -0400

    [#8619] sanitize class/id on void elements too
    
    Co-Authored-By: Claude Sonnet 5 <no...@anthropic.com>
    Claude-Session: https://claude.ai/code/session_018KZ3wfWGSAzjfQj3neMfG3
---
 Allura/allura/lib/utils.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Allura/allura/lib/utils.py b/Allura/allura/lib/utils.py
index c9a2d0555..b3af9e245 100644
--- a/Allura/allura/lib/utils.py
+++ b/Allura/allura/lib/utils.py
@@ -656,7 +656,8 @@ def sanitize_token(self, token):
             return None
 
         # sanitize classes and ids
-        if token.get('type') == 'StartTag':
+        # (void elements like <img>/<br>/<input> are 'EmptyTag', not 'StartTag')
+        if token.get('type') in ('StartTag', 'EmptyTag'):
             classes = token.get('data', {}).get((None, 'class'), '')
             if classes:
                 classes = classes.split()