Properly handle decoding paths

This commit is contained in:
Dane Everitt
2020-12-16 21:38:56 -08:00
parent 737e1fcef6
commit 0c93e5ed02
2 changed files with 19 additions and 2 deletions

View File

@@ -83,6 +83,13 @@ func (e *RequestError) AbortWithStatus(status int, c *gin.Context) {
return
}
if strings.HasPrefix(e.err.Error(), "invalid URL escape") {
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{
"error": "Some of the data provided in the request appears to be escaped improperly.",
})
return
}
// If this is a Filesystem error just return it without all of the tracking code nonsense
// since we don't need to be logging it into the logs or anything, its just a normal error
// that the user can solve on their end.