codimd/lib/middleware/checkURIValid.ts
Raccoon 758ffd462a
ts: lib/middleware/checkURIValid.js
Signed-off-by: Raccoon <raccoon@hackmd.io>
2021-06-16 18:35:21 +08:00

13 lines
257 B
TypeScript

import * as logger from '../logger'
import * as response from "../response";
export = function (req, res, next) {
try {
decodeURIComponent(req.path)
} catch (err) {
logger.error(err)
return response.errorBadRequest(req, res)
}
next()
}