Skip to content

Commit bacdd6e

Browse files
committed
RHINENG-21443: refactor - remove spacesOnly regex
1 parent eea93d8 commit bacdd6e

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

listener/templates.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func processTemplateEvent(value json.RawMessage) (eType string, event mqueue.Tem
148148
}
149149

150150
for i, d := range event.Data {
151-
if d.Description != nil && (len(*d.Description) == 0 || spacesRegex.MatchString(*d.Description)) {
151+
if d.Description != nil && strings.TrimSpace(*d.Description) == "" {
152152
d.Description = nil
153153
event.Data[i] = d
154154
}

listener/upload.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ var (
6868

6969
var (
7070
repoPathRegex = regexp.MustCompile(RepoPathPattern)
71-
spacesRegex = regexp.MustCompile(`^\s*$`)
7271
templateRepoPath = regexp.MustCompile(TemplateRepoPattern)
7372
httpClient *api.Client
7473
candlepinClient = candlepin.CreateCandlepinClient()
@@ -334,7 +333,7 @@ func updateSystemPlatform(tx *gorm.DB, accountID int, host *Host,
334333
}
335334

336335
displayName := inventoryID
337-
if host.DisplayName != nil && len(*host.DisplayName) > 0 && !spacesRegex.MatchString(*host.DisplayName) {
336+
if host.DisplayName != nil && strings.TrimSpace(*host.DisplayName) != "" {
338337
displayName = *host.DisplayName
339338
}
340339

0 commit comments

Comments
 (0)