fix(target): Incorrectly allowing whitespace on Target's address field (#2862)

This commit is contained in:
Hugo authored and GitHub committed 2023-02-02 10:51:39 -08:00
1 parent db42eafd7a
commit e455e31f9e
5 files changed
+88 -4

No files matched your search

@@ -1069,7 +1069,7 @@ func (s Service) createInRepo(ctx context.Context, item *pb.Target) (target.Targ
opts = append(opts, target.WithIngressWorkerFilter(item.GetIngressWorkerFilter().GetValue()))
}
if item.GetAddress() != nil {
opts = append(opts, target.WithAddress(item.GetAddress().GetValue()))
opts = append(opts, target.WithAddress(strings.TrimSpace(item.GetAddress().GetValue())))
}
attr, err := subtypeRegistry.newAttribute(target.SubtypeFromType(item.GetType()), item.GetAttrs())
@@ -1124,7 +1124,7 @@ func (s Service) updateInRepo(ctx context.Context, scopeId, id string, mask []st
}
if item.GetAddress() != nil {
dbMask = append(dbMask, "Address")
opts = append(opts, target.WithAddress(item.GetAddress().GetValue()))
opts = append(opts, target.WithAddress(strings.TrimSpace(item.GetAddress().GetValue())))
}
subtype := target.SubtypeFromId(id)