summaryrefslogtreecommitdiff
path: root/lib/web/middleware/checkURIValid.js
blob: cd6dabd2ffa620291243547e3a98f1bf067dcdac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'use strict'

const logger = require('../../logger')
const errors = require('../../errors')

module.exports = function (req, res, next) {
  try {
    decodeURIComponent(req.path)
  } catch (err) {
    logger.error(err)
    return errors.errorBadRequest(res)
  }
  next()
}