fix: address branch review issues (json tags, share lockout, session expiry, file unlink)
This commit is contained in:
@@ -80,9 +80,15 @@ func (s *Server) handleDownload(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func (s *Server) handleDeleteFile(w http.ResponseWriter, r *http.Request) {
|
||||
id := r.PathValue("id")
|
||||
f, err := s.store.FileGet(id)
|
||||
if err != nil {
|
||||
http.Error(w, "Not found", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
if err := s.store.FileDelete(id); err != nil {
|
||||
http.Error(w, "Failed to delete", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
os.Remove(filepath.Join(s.workspace, f.Dir, f.StorageName))
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user