Don't submit directories to MIME type checks or any other checks which depend upon them.

This commit is contained in:
Solderpunk 2019-06-05 20:53:33 +03:00
parent c2f90b0006
commit b37ce48228
1 changed files with 6 additions and 0 deletions

View File

@ -71,6 +71,12 @@ func GetHandler(config Config) http.HandlerFunc {
http.Error(w, "File not world-readable.", http.StatusForbidden)
return
}
// If this is a directory, nothing below makes sense, so just
// serve it!
if info.IsDir() {
http.ServeFile(w, r, path)
return
}
// Get MIME type
ext := filepath.Ext(path)