-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix using lowercase to query uppercase in MongoDB #16
Conversation
2d4a5ae
to
d41260b
Compare
} | ||
|
||
smPolicyData, pd := getDataFromDB(collName, filter) | ||
smPolicyData, pd := getDataFromDBWithArg(collName, filter, 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update util pkg to the latest and replace all 2
to mongoapi.COLLATION_STRENGTH_IGNORE_CASE
:
smPolicyData, pd := getDataFromDBWithArg(collName, filter, mongoapi.COLLATION_STRENGTH_IGNORE_CASE)
if pd != nil { | ||
return nil, pd | ||
} | ||
|
||
hex_snssai := util.SnssaiModelsToHex(snssai) | ||
found := false | ||
for snssai_str, val := range smPolicyData["smPolicySnssaiData"].(map[string]interface{}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smPolicySnssaiDatas, ok := smPolicyData["smPolicySnssaiData"].(map[string]interface{})
if !ok {
return nil, util.ProblemDetailsNotFound("DATA_NOT_FOUND")
}
for snssai, v := range smPolicySnssaiDatas {
if !strings.EqualFold(snssai, hex_snssai) {
continue
}
smPolicySnssaiData, ok := v.(map[string]interface{})
if !ok {
break
}
smPolicyDnnDatas, ok := smPolicySnssaiData["smPolicyDnnData"].(map[string]interface{})
if !ok {
break
}
for dnn := range smPolicyDnnDatas {
if strings.EqualFold(dnn, util.EscapeDnn(dnn)) == 0 {
found = true
break
}
}
if found {
break
}
}
go.sum
Outdated
@@ -64,8 +64,8 @@ github.com/evanphx/json-patch v0.5.2 h1:xVCHIVMUu1wtM/VkR9jVZ45N3FhZfYMMYGorLCR8 | |||
github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= | |||
github.com/free5gc/openapi v1.0.6 h1:ytRjU/YZRI8UhKKyfajXSyGB6s1YDFkJ1weeAGJ8LXw= | |||
github.com/free5gc/openapi v1.0.6/go.mod h1:iw/N0E+FlX44EEx24IBi2EdZW8v+bkj3ETWPGnlK9DI= | |||
github.com/free5gc/util v1.0.5-0.20230511064842-2e120956883b h1:XMw3j+4AEXLeL/uyiZ7/qYE1X7Ul05RTwWBhzxCLi+0= | |||
github.com/free5gc/util v1.0.5-0.20230511064842-2e120956883b/go.mod h1:l2Jrml4vojDomW5jdDJhIS60KdbrE9uPYhyAq/7OnF4= | |||
github.com/free5gc/util v1.0.5-0.20230816143033-e726373b7087 h1:gkY/Njn/OWQMITQfZ1q8QjRLN4ElDEQYAQWtV+MpYwc= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update util pkg to the latest
break | ||
} | ||
for dnn := range smPolicyDnnDatas { | ||
if strings.EqualFold(dnn, util.EscapeDnn(dnn)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this part should be:
for cmpDnn := range smPolicyDnnData {
if strings.EqualFold(cmpDnn, util.EscapeDnn(dnn)) {
found = true
break
}
}
No description provided.