Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
[HOTFIX] Fix processing of jsonpath for SLIS select criteria (#3875)
Browse files Browse the repository at this point in the history
* Fix processing of jsonpath for slis select criteria

* Fix lint
  • Loading branch information
emmakarova authored May 15, 2024
1 parent 172a7dc commit d9f54bf
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions components/director/cmd/systemfetcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/json"
"net/http"
"os"
"regexp"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -704,15 +705,15 @@ func calculateTemplateMappings(ctx context.Context, cfg config, transact persist
}

func getTopParentFromJSONPath(jsonPath string) string {
infix := "."
trimmedJSONPath := strings.TrimPrefix(jsonPath, systemfetcher.TrimPrefix)

topParent := strings.TrimPrefix(jsonPath, systemfetcher.TrimPrefix)
firstInfixIndex := strings.Index(topParent, infix)
if firstInfixIndex == -1 {
return topParent
regexForTopParent := regexp.MustCompile(`^[^\[.]+`)
topParent := regexForTopParent.FindStringSubmatch(trimmedJSONPath)
if len(topParent) > 0 {
return topParent[0]
}

return topParent[:firstInfixIndex]
return trimmedJSONPath
}

func addPropertiesFromAppTemplatePlaceholders(selectFilterProperties map[string]bool, placeholders []model.ApplicationTemplatePlaceholder) {
Expand Down

0 comments on commit d9f54bf

Please sign in to comment.