From 73ec77224ee198c7e0a21f8ad047280d3fec2f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mime=20=C4=8Cuvalo?= Date: Sun, 5 Nov 2023 01:04:35 +0000 Subject: [PATCH] rss: set content-type for xml better --- pages/api/social/comments.tsx | 4 ++-- pages/api/social/feed.tsx | 2 +- pages/api/social/foaf.tsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/api/social/comments.tsx b/pages/api/social/comments.tsx index 43b7db1a..568be485 100644 --- a/pages/api/social/comments.tsx +++ b/pages/api/social/comments.tsx @@ -14,13 +14,13 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) const comments = await getRemoteCommentsOnLocalContent(req.query.resource as string); let renderedTree = - `` + + `` + renderToString(); // XXX(mime): in the feeds I have some attributes that are `ref`. However, ref isn't allowed in React, // so in the DOM they are `refXXX`. Return them to normal here, sigh. renderedTree = renderedTree.replace(/refXXX="([^"]+)"/g, 'ref="$1"'); - res.setHeader('Content-Type', 'xml'); + res.setHeader('Content-Type', 'application/xml'); res.send(renderedTree); } diff --git a/pages/api/social/feed.tsx b/pages/api/social/feed.tsx index 36c50f46..60bd9bf5 100644 --- a/pages/api/social/feed.tsx +++ b/pages/api/social/feed.tsx @@ -23,7 +23,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) // so in the DOM they are `refXXX`. Return them to normal here, sigh. renderedTree = renderedTree.replace(/refXXX="([^"]+)"/g, 'ref="$1"'); - res.setHeader('Content-Type', 'xml'); + res.setHeader('Content-Type', 'application/xml'); res.send(renderedTree); } diff --git a/pages/api/social/foaf.tsx b/pages/api/social/foaf.tsx index dc0d00a5..c260ed5c 100644 --- a/pages/api/social/foaf.tsx +++ b/pages/api/social/foaf.tsx @@ -17,7 +17,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) res.setHeader('Content-Type', 'application/xrd+xml'); res.send( - `` + + `` + renderToString() ); }