Merge pull request #38796 from ShrihariMahabal/escape-icon-color

fix: escape icon and color fields
This commit is contained in:
Shrihari Mahabal 2026-04-22 15:02:39 +05:30 committed by GitHub
commit 1b8f6cddbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -394,20 +394,20 @@ frappe.form.formatters = {
return formatted_values.join(", "); return formatted_values.join(", ");
}, },
Color: (value) => { Color: (value) => {
return value if (!value) return "";
? `<div> let escaped_value = frappe.utils.escape_html(value);
<div class="selected-color" style="background-color: ${value}"></div> return `<div>
<span class="color-value">${value}</span> <div class="selected-color" style="background-color: ${escaped_value}"></div>
</div>` <span class="color-value">${escaped_value}</span>
: ""; </div>`;
}, },
Icon: (value) => { Icon: (value) => {
return value if (!value) return "";
? `<div class='flex' style='gap: 8px;'> let escaped_value = frappe.utils.escape_html(value);
<div class="selected-icon">${frappe.utils.icon(value, "md")}</div> return `<div class='flex' style='gap: 8px;'>
<span class="icon-value">${value}</span> <div class="selected-icon">${frappe.utils.icon(escaped_value, "md")}</div>
</div>` <span class="icon-value">${escaped_value}</span>
: ""; </div>`;
}, },
Attach: format_attachment_url, Attach: format_attachment_url,
AttachImage: format_attachment_url, AttachImage: format_attachment_url,