Skip to content

Commit 512d520

Browse files
author
Frank Eickhoff
committed
OX-1168 raise error if strict key is not true
1 parent aa5f8dd commit 512d520

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

client/operation_read_object_group.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,16 @@ func recoverFilterJSON(input string) (string, error) {
3939
regex := entry["regex"] // Access the "regex" key.
4040

4141
// Check the type of the "regex" key.
42-
switch regex.(type) {
42+
switch regexValue := regex.(type) {
4343
case map[string]interface{}:
44-
// If "regex" is a map, set it to the value of the "pattern" key.
45-
regexMap := regex.(map[string]interface{})
46-
entry["regex"] = regexMap["pattern"]
44+
// If "regex" is a map, check if the "strict" key is true.
45+
if strict, ok := regexValue["strict"].(bool); ok && strict {
46+
// If "strict" is true, set "regex" to the value of the "pattern" key.
47+
entry["regex"] = regexValue["pattern"]
48+
} else {
49+
// If "strict" is not true, return an error.
50+
return "", fmt.Errorf("strict key is not true")
51+
}
4752
case string:
4853
// If "regex" is a string, no action is needed.
4954
default:

0 commit comments

Comments
 (0)