We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 943f3e5 commit e94ef0fCopy full SHA for e94ef0f
routes/redirect.js
@@ -9,10 +9,12 @@ module.exports = Router()
9
res.set('Cache-Control', `public, max-age=${cacheAge}`)
10
res.redirect(301, process.env.HOMEPAGE)
11
})
12
- .get(`/:hash(${schema.Link.properties.hash.pattern})`, async (req, res) => {
+ .get(`/:hash`, async (req, res) => {
13
+ // Just do the validation in the route; ^pattern$ doesn't work well with express routes.
14
if (
15
req.params.hash.length < schema.Link.properties.hash.minLength ||
- req.params.hash.length > schema.Link.properties.hash.maxLength
16
+ req.params.hash.length > schema.Link.properties.hash.maxLength ||
17
+ !new RegExp(schema.Link.properties.hash.pattern, 'u').test(req.params)
18
)
19
return res.sendStatus(404)
20
0 commit comments