Skip to content

Commit

Permalink
RHINENG-8852: check display name for whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
psegedy committed Mar 14, 2024
1 parent 742887f commit 333278a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion listener/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const (
var (
DeletionThreshold = time.Hour * time.Duration(utils.GetIntEnvOrDefault("SYSTEM_DELETE_HRS", 4))
repoPathRegex = regexp.MustCompile(RepoPathPattern)
spacesRegex = regexp.MustCompile(`^\s*$`)
httpClient *api.Client
)

Expand Down Expand Up @@ -310,7 +311,7 @@ func updateSystemPlatform(tx *gorm.DB, inventoryID string, accountID int, host *

now := time.Now()
displayName := inventoryID
if host.DisplayName != nil && len(*host.DisplayName) > 0 {
if host.DisplayName != nil && len(*host.DisplayName) > 0 && !spacesRegex.MatchString(*host.DisplayName) {
displayName = *host.DisplayName
}

Expand Down

0 comments on commit 333278a

Please sign in to comment.