package main import ( "log" "net/http" "os" ) func uploaderDelete(w http.ResponseWriter, r *http.Request) { // r.URL.Path is sanitized regarding "." and ".." filename := r.URL.Path filepath := conf.filepath + filename if verbose { log.Printf("Deleting file %s", filepath) } f, err := os.Open(filepath) if err != nil { http.NotFound(w, r) return } f.Close() // Force file expiration writemeta(filepath, 0) w.WriteHeader(http.StatusNoContent) }