This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"encoding/json"
|
||||
"log"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"code.riskrancher.com/RiskRancher/core/pkg/domain"
|
||||
)
|
||||
@@ -76,14 +75,15 @@ func (h *Handler) HandleCSVIngest(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
adapterIDStr := r.FormValue("adapter_id")
|
||||
adapterID, err := strconv.Atoi(adapterIDStr)
|
||||
if err != nil {
|
||||
http.Error(w, "Invalid adapter_id", http.StatusBadRequest)
|
||||
// 1. Grab the adapter_name sent by the frontend JS
|
||||
adapterName := r.FormValue("adapter_name")
|
||||
if adapterName == "" {
|
||||
http.Error(w, "Missing adapter_name", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
adapter, err := h.Store.GetAdapterByID(r.Context(), adapterID)
|
||||
// 2. Look up the adapter by Name instead of ID
|
||||
adapter, err := h.Store.GetAdapterByName(r.Context(), adapterName)
|
||||
if err != nil {
|
||||
http.Error(w, "Adapter mapping not found", http.StatusNotFound)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user