package main import ( "log" "net/http" "github.com/dustin/go-humanize" ) func uploaderGet(w http.ResponseWriter, r *http.Request) { // r.URL.Path is sanitized regarding "." and ".." filename := r.URL.Path if r.URL.Path == "/" || r.URL.Path == "/index.html" { data := templatedata{Maxsize: humanize.IBytes(uint64(conf.maxsize))} servetemplate(w, "/index.html", data) return } if verbose { log.Printf("Serving file %s", conf.rootdir+filename) } http.ServeFile(w, r, conf.rootdir+filename) }