~gjabell/binit

0c7fa3f047ab3125bc576fb5d5e06bb8adf5d297 — Galen Abell 2 years ago 32b0860 main 0.3.2
Don't expose filesystem list on /
1 files changed, 5 insertions(+), 0 deletions(-)

M server.go
M server.go => server.go +5 -0
@@ 63,6 63,11 @@ func (s *Server) get(w http.ResponseWriter, r *http.Request) {
	path := strings.Trim(r.URL.Path, "/")
	path = filepath.Join(s.config.UploadDir, filepath.Clean(path))

	if path == s.config.UploadDir {
		http.Error(w, "404 page not found", http.StatusNotFound)
		return
	}

	http.ServeFile(w, r, path)
}