edit agenda handlers

This commit is contained in:
Nicolas CARON 2024-10-15 10:51:15 +02:00
parent 434be30074
commit 7184f4735c
1 changed files with 7 additions and 18 deletions

View File

@ -240,13 +240,8 @@ func (h *ApplicationHandler) AgendaDisplayEvent(w http.ResponseWriter, r *http.R
}
}
documents:= []filestorage.FileInfo{}
files := h.filestorage.List(filestorage.PREFIX_AGENDA + "/" + eventid)
for _, f := range files {
if strings.HasPrefix(f.Key, eventid) {
documents = append(documents, f)
}
}
documents := h.filestorage.List(filestorage.PREFIX_AGENDA + "/" + eventid)
events_file_types := h.config.GetStringSlice("modules.agenda.documents_types")
file_types_map := h.config.GetStringMapString("storage.files.file_types")
@ -727,17 +722,11 @@ func (h *ApplicationHandler) EventDocuments(w http.ResponseWriter, r *http.Reque
fmt.Println("metadata", metadata)
fmt.Println(filestorage.PREFIX_AGENDA)
// if err := h.filestorage.Put(file, filestorage.PREFIX_AGENDA, fmt.Sprintf("%s/%s_%s", eventID, fileid, header.Filename), header.Size, metadata); err != nil {
// fmt.Println(err)
// w.WriteHeader(http.StatusInternalServerError)
// return
// }
// if err := h.filestorage.Put(file, filestorage.PREFIX_BENEFICIARIES, fmt.Sprintf("%s/%s_%s", eventID, fileid, header.Filename), header.Size, metadata); err != nil {
// fmt.Println(err)
// w.WriteHeader(http.StatusInternalServerError)
// return
// }
if err := h.filestorage.Put(file, filestorage.PREFIX_AGENDA, fmt.Sprintf("%s/%s_%s", eventID, fileid, header.Filename), header.Size, metadata); err != nil {
fmt.Println(err)
w.WriteHeader(http.StatusInternalServerError)
return
}
http.Redirect(w, r, fmt.Sprintf("/app/agenda/%s", eventID), http.StatusFound)