From 6a29419bff732436f552d2cd4450142a9a3ac415 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Mon, 18 May 2020 00:13:08 +1200 Subject: [PATCH] FIx infinite loop --- package-lock.json | 4 ++-- package.json | 2 +- src/site/api/404.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2d3cff3..5df6a80 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2738,8 +2738,8 @@ "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==" }, "pinski": { - "version": "github:cloudrac3r/pinski#6273f81facd1e753e021910f7aa6e4384cf60631", - "from": "github:cloudrac3r/pinski#6273f81facd1e753e021910f7aa6e4384cf60631", + "version": "github:cloudrac3r/pinski#64e588416e27da406711d853778dfcd729138397", + "from": "github:cloudrac3r/pinski#64e588416e27da406711d853778dfcd729138397", "requires": { "mime": "^2.4.4", "pug": "^2.0.3", diff --git a/package.json b/package.json index ae69428..b81fd9e 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "mixin-deep": "^2.0.1", "node-dir": "^0.1.17", "node-fetch": "^2.6.0", - "pinski": "github:cloudrac3r/pinski#6273f81facd1e753e021910f7aa6e4384cf60631", + "pinski": "github:cloudrac3r/pinski#64e588416e27da406711d853778dfcd729138397", "pug": "^2.0.4", "semver": "^7.2.1", "sharp": "^0.25.2", diff --git a/src/site/api/404.js b/src/site/api/404.js index 9b13c3c..22ad4a2 100644 --- a/src/site/api/404.js +++ b/src/site/api/404.js @@ -2,9 +2,9 @@ const {render} = require("pinski/plugins") const constants = require("../../lib/constants") module.exports = [ - {route: "/404", methods: ["GET", "POST", "PATCH", "DELETE"], code: async ({url}) => { + {route: "/404", methods: ["*"], code: async ({url}) => { const path = url.searchParams.get("pathname") - const couldBeUsername = path.match(`^/${constants.external.username_regex}$`) + const couldBeUsername = path && path.match(`^/${constants.external.username_regex}(?:/channel)?$`) return render(404, "pug/404.pug", {path, couldBeUsername}) }} ]