patched adapter bug
Build and Release Core / Test and Build (push) Failing after 5m41s

This commit is contained in:
t
2026-05-07 13:24:30 -04:00
parent 7fecb4905e
commit bda39c40f6
5 changed files with 81 additions and 56 deletions
+6 -6
View File
@@ -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