-
Notifications
You must be signed in to change notification settings - Fork 272
asset group tags to not contain whitespaces #437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
06ead89 to
be6a9fb
Compare
36bac5a to
d017a4e
Compare
zinic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me!
|
|
||
| if err := api.ReadJSONRequestPayloadLimited(&createRequest, request); err != nil { | ||
| api.WriteErrorResponse(request.Context(), api.BuildErrorResponse(http.StatusBadRequest, err.Error(), request), response) | ||
| } else if strings.Contains(createRequest.Tag, " ") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick question: should we disallow all forms of whitespace? It seems like it may be a good idea just to be safe. We'd probably use a regex to test for any whitespace character, rather than enumerate whitespace checks manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, I'll add this in a follow up MR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to make this v5.8.0 due to the next version definitely being a feature update
Description
Whitespaces in asset group tags conflict with delimiters in the "system_group" properties. This MR adds a check to disallow spaces in the tags field when creating an asset group. It also adds a database migration to update any existing asset group tags and trim the whitespace out.
How Has This Been Tested?
Added unit test for validation
Manual test for database migration
Screenshots (if appropriate):
Set up the database with one asset group containing a space in the tag

Ran the update to remove spaces

Verified that the spaces are removed from id=3

Types of changes
Checklist: