Skip to content

Commit

Permalink
fix: geojsonhnt errors handler is not correct
Browse files Browse the repository at this point in the history
  • Loading branch information
cnouguier committed Nov 15, 2021
1 parent 3927f50 commit 613541d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ const featuresValidator = function (req, res, next) {
type: 'FeatureCollection',
features: req.body.features
}
const errors = geojsonhint.hint(collection)
// lint the geojson file
const messages = geojsonhint.hint(collection)
// filter the messages to find the errors
const errors = _.filter(messages, message => { return _.get(message, 'level') !== 'message' })
if (errors.length > 0) res.status(422).json({ message: 'Invdalid \"features\" format', errors })
else next()
} else {
Expand Down

0 comments on commit 613541d

Please sign in to comment.