summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolderpunk <solderpunk@sdf.org>2019-06-05 20:53:33 +0300
committerSolderpunk <solderpunk@sdf.org>2019-06-05 20:53:33 +0300
commitb37ce482284cb55c3392a59ec0345d28189e1ca8 (patch)
treef36817b8c74f824a39d27d1487c2d277539bce1f
parentc2f90b00069543d2b562f08e0e3c041113bb9128 (diff)
Don't submit directories to MIME type checks or any other checks which depend upon them.
-rw-r--r--httphandlers.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/httphandlers.go b/httphandlers.go
index 14c358c..e09392a 100644
--- a/httphandlers.go
+++ b/httphandlers.go
@@ -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)