From 6784b7cb7a6936a627959cdef11b949baa064e55 Mon Sep 17 00:00:00 2001 From: "CTFang@WireLab" Date: Thu, 24 Oct 2024 05:12:18 +0000 Subject: [PATCH] fix: nf discovery filter & token request reflect type --- internal/sbi/api_accesstoken.go | 3 ++- internal/sbi/processor/nf_discovery.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/sbi/api_accesstoken.go b/internal/sbi/api_accesstoken.go index 9c29068..91a77f5 100644 --- a/internal/sbi/api_accesstoken.go +++ b/internal/sbi/api_accesstoken.go @@ -80,7 +80,8 @@ func (s *Server) HTTPAccessTokenRequest(c *gin.Context) { break } } - if vt.Name() == "string" || vt.Name() == "NfType" { + if vt == reflect.TypeOf("") || vt == reflect.TypeOf(models.NrfNfManagementNfType_NRF) { + // Type is string reflect.ValueOf(&accessTokenReq).Elem().FieldByName(name).SetString(value[0]) } else { plmnid := models.PlmnId{} diff --git a/internal/sbi/processor/nf_discovery.go b/internal/sbi/processor/nf_discovery.go index 7bc56ae..0acc9d4 100644 --- a/internal/sbi/processor/nf_discovery.go +++ b/internal/sbi/processor/nf_discovery.go @@ -340,9 +340,10 @@ func buildFilter(queryParameters url.Values) bson.M { // Pattern: '^[A-Fa-f0-9]{6}$' if queryParameters["snssais"] != nil { snssais := queryParameters["snssais"][0] + // snssais = [{"sst":1,"sd":"fedcba"}] var snssaisBsonArray bson.A - slices := util.SnssaisToBsonM(snssais) + slices := util.SnssaisToBsonM(snssais[1 : len(snssais)-1]) for _, slice := range slices { snssaisBsonArray = append(snssaisBsonArray, bson.M{"sNssais": bson.M{"$elemMatch": slice}}) }