1
Fork 0
mirror of https://github.com/thegeneralist01/archivr synced 2026-07-21 18:55:36 +02:00

fix: decode HTML entities in entry titles

This commit is contained in:
TheGeneralist 2026-07-04 11:42:33 +02:00
parent d3a78da766
commit 98238cd1f3
Signed by: thegeneralist01
SSH key fingerprint: SHA256:pp9qddbCNmVNoSjevdvQvM5z0DHN7LTa8qBMbcMq/R4

View file

@ -10,8 +10,19 @@ export function formatBytes(bytes) {
return `${size.toFixed(unit === 0 ? 0 : 1)} ${units[unit]}`; return `${size.toFixed(unit === 0 ? 0 : 1)} ${units[unit]}`;
} }
export function decodeHtmlEntities(str) {
if (!str) return str;
return str
.replace(/&/g, "&")
.replace(/&lt;/g, "<")
.replace(/&gt;/g, ">")
.replace(/&quot;/g, '"')
.replace(/&#39;/g, "'")
.replace(/&apos;/g, "'");
}
export function valueText(value) { export function valueText(value) {
return value ?? ""; return decodeHtmlEntities(value) ?? "";
} }
export function formatTimestamp(value) { export function formatTimestamp(value) {