Changeset 64 in code for trunk/partage.go
- Timestamp:
- Nov 28, 2022, 9:49:13 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/partage.go
r63 r64 244 244 } 245 245 246 func uploaderDelete(w http.ResponseWriter, r *http.Request) { 247 // r.URL.Path is sanitized regarding "." and ".." 248 filename := r.URL.Path 249 filepath := conf.filepath + filename 250 251 if verbose { 252 log.Printf("Deleting file %s", filepath) 253 } 254 255 f, err := os.Open(filepath) 256 if err != nil { 257 http.NotFound(w, r) 258 return 259 } 260 f.Close() 261 262 // Force file expiration 263 writemeta(filepath, 0) 264 w.WriteHeader(http.StatusNoContent) 265 } 266 246 267 func uploader(w http.ResponseWriter, r *http.Request) { 247 268 if verbose { … … 250 271 251 272 switch r.Method { 273 case "DELETE": 274 uploaderDelete(w, r) 252 275 case "POST": 253 276 uploaderPost(w, r)
Note:
See TracChangeset
for help on using the changeset viewer.