diff --git a/router/router_server_files.go b/router/router_server_files.go index a7db31e..4559e0c 100644 --- a/router/router_server_files.go +++ b/router/router_server_files.go @@ -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 }