]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
markdown parser: normalize tag names and protocol for check
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 3 Jun 2023 10:33:48 +0000 (12:33 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 3 Jun 2023 11:41:23 +0000 (13:41 +0200)
As the tag names are often uppercase, and so this was overly strict
and didn't always match correctly

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/Parser.js

index 0a4423025dcde8f9969421c5fd594de3cc950d64..e283df8a058c500bd9582cb0111da9f29ef639f8 100644 (file)
@@ -32,7 +32,10 @@ Ext.define('Proxmox.Markdown', {
                } else if ((name === 'href' || name === 'src') && !_isHTTPLike(value)) {
                    try {
                        let url = new URL(value, window.location.origin);
-                       if (_isHTTPLike(url.protocol) || (node.tagName === 'img' && url.protocol === 'data:')) {
+                       if (
+                           _isHTTPLike(url.protocol) ||
+                           (node.tagName.toLowerCase() === 'img' && url.protocol.toLowerCase() === 'data:')
+                       ) {
                            node.attributes[i].value = url.href;
                        } else {
                            node.attributes.removeNamedItem(name);