@@ -1471,27 +1471,42 @@ func RemoveRepo(c *gin.Context) {
14711471 }
14721472
14731473 // Also check status.reconciledRepos for repos added directly to runner
1474- status , _ := item .Object ["status" ].(map [string ]interface {})
1475- reconciledRepos , _ := status ["reconciledRepos" ].([]interface {})
1474+ status , found , err := unstructured .NestedMap (item .Object , "status" )
1475+ if ! found || err != nil {
1476+ log .Printf ("Failed to get status: %v" , err )
1477+ status = make (map [string ]interface {})
1478+ }
1479+
1480+ reconciledRepos , found , err := unstructured .NestedSlice (status , "reconciledRepos" )
1481+ if ! found || err != nil {
1482+ log .Printf ("Failed to get reconciledRepos: %v" , err )
1483+ reconciledRepos = []interface {}{}
1484+ }
1485+
14761486 foundInReconciled := false
14771487 for _ , r := range reconciledRepos {
1478- rm , _ := r .(map [string ]interface {})
1479- name , _ := rm ["name" ].(string )
1480- if name == repoName {
1488+ rm , ok := r .(map [string ]interface {})
1489+ if ! ok {
1490+ continue
1491+ }
1492+
1493+ name , found , err := unstructured .NestedString (rm , "name" )
1494+ if found && err == nil && name == repoName {
14811495 foundInReconciled = true
14821496 break
14831497 }
1498+
14841499 // Also try matching by URL
1485- url , _ := rm [ "url" ].( string )
1486- if DeriveRepoFolderFromURL (url ) == repoName {
1500+ url , found , err := unstructured . NestedString ( rm , "url" )
1501+ if found && err == nil && DeriveRepoFolderFromURL (url ) == repoName {
14871502 foundInReconciled = true
14881503 break
14891504 }
14901505 }
14911506
14921507 // Always call runner to remove from filesystem (if session is running)
14931508 // Do this BEFORE checking if repo exists in CR, because it might only be on filesystem
1494- phase , _ := status [ "phase" ].( string )
1509+ phase , _ , _ := unstructured . NestedString ( status , "phase" )
14951510 runnerRemoved := false
14961511 if phase == "Running" {
14971512 runnerURL := fmt .Sprintf ("http://session-%s.%s.svc.cluster.local:8001/repos/remove" , sessionName , project )
0 commit comments