From 13cf286874e28b66091df25a2cc41653d6201338 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Mon, 5 Sep 2022 15:35:36 -0700 Subject: [PATCH] Fix www replace. --- lib/filters.js | 4 ++-- pages/api/heartbeat.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/filters.js b/lib/filters.js index 087b92bf..4e7773f4 100644 --- a/lib/filters.js +++ b/lib/filters.js @@ -7,7 +7,7 @@ export const urlFilter = data => { try { const { pathname, search } = new URL(url, location.origin); - if (search.startsWith('?/')) { + if (search.startsWith('?')) { return `${pathname}${search}`; } @@ -47,7 +47,7 @@ export const refFilter = data => { try { const url = new URL(x); - id = url.hostname.replace('www', '') || url.href; + id = url.hostname.replace(/www\./, '') || url.href; } catch { id = ''; } diff --git a/pages/api/heartbeat.js b/pages/api/heartbeat.js index dd1be1eb..a4ee5923 100644 --- a/pages/api/heartbeat.js +++ b/pages/api/heartbeat.js @@ -1,5 +1,5 @@ import { ok } from 'next-basics'; export default async (req, res) => { - return ok(res, 'nice'); + return ok(res); };