
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja> git-svn-id: https://svn.yakumo.dev/yakumo.izuru/marisa/trunk@67 d6811dac-2434-b64a-9ddc-f563ab233461
29 lines
595 B
Go
29 lines
595 B
Go
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)
|
|
}
|