Return a 404 when the directory does not exist
This commit is contained in:
parent
21303dc517
commit
115131575d
|
@ -78,6 +78,13 @@ func getServerListDirectory(c *gin.Context) {
|
|||
|
||||
stats, err := s.Filesystem.ListDirectory(d)
|
||||
if err != nil {
|
||||
if err.Error() == "readdirent: not a directory" {
|
||||
c.AbortWithStatusJSON(http.StatusNotFound, gin.H{
|
||||
"error": "The requested directory does not exist.",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
TrackedServerError(err, s).AbortWithServerError(c)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user