diff options
| author | Fuwn <[email protected]> | 2023-10-23 16:52:02 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-10-23 16:52:02 -0700 |
| commit | 78a6e2f7b1d8b46f98bf27562cc6a646871fda5c (patch) | |
| tree | 84c80cdbe7af4ee8bc60cd8926414ea5922a2466 /src | |
| parent | fix(list): compare episodes to progress highlight (diff) | |
| download | due.moe-78a6e2f7b1d8b46f98bf27562cc6a646871fda5c.tar.xz due.moe-78a6e2f7b1d8b46f98bf27562cc6a646871fda5c.zip | |
fix(feeds): html encode title
Diffstat (limited to 'src')
| -rw-r--r-- | src/routes/feeds/activity-notifications/+server.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/routes/feeds/activity-notifications/+server.ts b/src/routes/feeds/activity-notifications/+server.ts index 06c55ace..dd4ee0b4 100644 --- a/src/routes/feeds/activity-notifications/+server.ts +++ b/src/routes/feeds/activity-notifications/+server.ts @@ -1,5 +1,9 @@ import { notifications, type Notification } from '$lib/AniList/notifications'; +const htmlEncode = (input: string) => { + return input.replace(/[\u00A0-\u9999<>&]/g, (i) => '&#' + i.charCodeAt(0) + ';'); +}; + const render = (posts: Notification[] = []) => `<?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0" @@ -41,7 +45,7 @@ const render = (posts: Notification[] = []) => `<?xml version="1.0" encoding="UT return `<item> <guid isPermaLink="false">${notification.id}</guid> -<title>${title}</title> +<title>${htmlEncode(title)}</title> <link>${link}</link> <author>${notification.user.name}</author> <media:thumbnail url="${notification.user.avatar.large}" /> |