markdown parser: normalize tag names and protocol for check

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>
This commit is contained in:
Thomas Lamprecht 2023-06-03 12:33:48 +02:00
parent 28f879c09e
commit b0c7069a10

View 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);