Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/CR-24413-version-array' into CR-…
Browse files Browse the repository at this point in the history
…23204-live-state-vers
  • Loading branch information
andrii-codefresh committed Oct 3, 2024
2 parents 19675c0 + 52f7182 commit 79f95e7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions reposerver/repository/app_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,16 @@ func getVersionFromFile(appPath, jsonPathExpression string) (*string, error) {
if err != nil {
return nil, err
}
appVersion, ok := versionValue.(string)
if !ok {

var appVersion string
var conversionSuccess bool
if versionArray, ok := versionValue.([]interface{}); ok && len(versionArray) > 0 {
appVersion, conversionSuccess = versionArray[0].(string)
} else {
appVersion, conversionSuccess = versionValue.(string)
}

if !conversionSuccess {
if versionValue == nil {
log.Info("Version value is not a string. Got: nil")
} else {
Expand Down

0 comments on commit 79f95e7

Please sign in to comment.