From 5a18a1d041ca46b05466a5f81d7c4cc97fe9012c Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 15 Jun 2021 22:49:29 -0700 Subject: [PATCH] Oops, fix outfit page SSR title Untitled outfits need a fallback, or else they show "null"! --- api/outfitPageSSR.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/outfitPageSSR.js b/api/outfitPageSSR.js index 4af0ee17..68a2898e 100644 --- a/api/outfitPageSSR.js +++ b/api/outfitPageSSR.js @@ -58,6 +58,8 @@ async function handle(req, res) { return sendHtml(res, initialHtml, 404); } + const outfitName = outfit.name || "Untitled outfit"; + // Okay, now let's rewrite the HTML to include some outfit data! // // WARNING!!! @@ -69,7 +71,7 @@ async function handle(req, res) { // Add the outfit name to the title. html = html.replace( /(.*)<\/title>/, - `<title>${escapeHtml(outfit.name)} | Dress to Impress` + `${escapeHtml(outfitName)} | Dress to Impress` ); // Add sharing meta tags just before the tag. @@ -85,7 +87,7 @@ async function handle(req, res) { `/v/${encodeURIComponent(updatedAtTimestamp)}` + `/600.png`; const metaTags = ` - +