FIx infinite loop

This commit is contained in:
Cadence Ember 2020-05-18 00:13:08 +12:00
parent 4e6ddcbcc8
commit 6a29419bff
No known key found for this signature in database
GPG Key ID: 128B99B1B74A6412
3 changed files with 5 additions and 5 deletions

4
package-lock.json generated
View File

@ -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",

View File

@ -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",

View File

@ -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})
}}
]