build(deps): bump github.com/CiscoM31/godata from 1.0.9 to 1.0.10
Bumps [github.com/CiscoM31/godata](https://github.com/CiscoM31/godata) from 1.0.9 to 1.0.10. - [Release notes](https://github.com/CiscoM31/godata/releases) - [Commits](https://github.com/CiscoM31/godata/compare/v1.0.9...v1.0.10) --- updated-dependencies: - dependency-name: github.com/CiscoM31/godata dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
Ralf Haferkamp
parent
c37ef2b62b
commit
b5e441c522
+8
@@ -139,6 +139,14 @@ func ParseExpandItem(ctx context.Context, input tokenQueue) (*ExpandItem, error)
|
||||
queue = &tokenQueue{}
|
||||
}
|
||||
} else if token.Value == "/" && stack.Empty() {
|
||||
if queue.Empty() {
|
||||
// Disallow extra leading and intermediate slash, like /Product and Product//Info
|
||||
return nil, BadRequestError("Empty path segment in expand clause.")
|
||||
}
|
||||
if input.Empty() {
|
||||
// Disallow extra trailing slash, like Product/
|
||||
return nil, BadRequestError("Empty path segment in expand clause.")
|
||||
}
|
||||
// at root level, slashes separate path segments
|
||||
item.Path = append(item.Path, queue.Dequeue())
|
||||
} else if token.Value == ";" && stack.Size == 1 {
|
||||
|
||||
+26
-4
@@ -11,11 +11,16 @@ type SelectItem struct {
|
||||
}
|
||||
|
||||
func ParseSelectString(ctx context.Context, sel string) (*GoDataSelectQuery, error) {
|
||||
return GlobalExpressionParser.ParseSelectString(ctx, sel)
|
||||
}
|
||||
|
||||
func (p *ExpressionParser) ParseSelectString(ctx context.Context, sel string) (*GoDataSelectQuery, error) {
|
||||
items := strings.Split(sel, ",")
|
||||
|
||||
result := []*SelectItem{}
|
||||
|
||||
for _, item := range items {
|
||||
item = strings.TrimSpace(item)
|
||||
|
||||
cfg, hasComplianceConfig := ctx.Value(odataCompliance).(OdataComplianceConfig)
|
||||
if !hasComplianceConfig {
|
||||
@@ -27,11 +32,28 @@ func ParseSelectString(ctx context.Context, sel string) (*GoDataSelectQuery, err
|
||||
return nil, BadRequestError("Extra comma in $select.")
|
||||
}
|
||||
|
||||
segments := []*Token{}
|
||||
for _, val := range strings.Split(item, "/") {
|
||||
segments = append(segments, &Token{Value: val})
|
||||
if _, err := p.tokenizer.Tokenize(ctx, item); err != nil {
|
||||
switch e := err.(type) {
|
||||
case *GoDataError:
|
||||
return nil, &GoDataError{
|
||||
ResponseCode: e.ResponseCode,
|
||||
Message: "Invalid $select value",
|
||||
Cause: e,
|
||||
}
|
||||
default:
|
||||
return nil, &GoDataError{
|
||||
ResponseCode: 500,
|
||||
Message: "Invalid $select value",
|
||||
Cause: e,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
segments := []*Token{}
|
||||
for _, val := range strings.Split(item, "/") {
|
||||
segments = append(segments, &Token{Value: val})
|
||||
}
|
||||
result = append(result, &SelectItem{segments})
|
||||
}
|
||||
result = append(result, &SelectItem{segments})
|
||||
}
|
||||
|
||||
return &GoDataSelectQuery{result, sel}, nil
|
||||
|
||||
Reference in New Issue
Block a user