Skip to content
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

fix(config/cors): use strings.Fields for string to string slice fields #1179

Merged
merged 1 commit into from
Nov 29, 2022

Conversation

GeorgeMac
Copy link
Contributor

@showwin pointed out that we regressed in terms of splitting behaviour on allowed_origins here:
#1173

Before the config refactor, we were splitting using strings.Fields() (this was the internal behaviour of viper.GetStringSlice()). Afterwards, mapstructure.StringToSliceHook(",") was leading to a simple strings.Split(..., ",").

This adjusts the string to slice hook to use strings.Fields(...).
This function treats one or more consecutive whitespace characters as a delimiter.
I added an example case to demonstrate this.

Once merged, we will cut a few patch releases on previous versions.

@GeorgeMac GeorgeMac requested a review from a team as a code owner November 29, 2022 09:59
Copy link
Collaborator

@markphelps markphelps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@GeorgeMac GeorgeMac merged commit 518ec32 into main Nov 29, 2022
@GeorgeMac GeorgeMac deleted the gm/config-slice-separator branch November 29, 2022 13:36
GeorgeMac added a commit that referenced this pull request Nov 29, 2022
…ing slice fields (#1179) (#1180)

* fix(config/cors): use strings.Fields for string to string slice fields (#1179)

* chore: update CHANGELOG
GeorgeMac added a commit that referenced this pull request Nov 29, 2022
…ng slice fields (#1179) (#1181)

* fix(config/cors): use strings.Fields for string to string slice fields (#1179)

* chore: update CHANGELOG
GeorgeMac added a commit that referenced this pull request Nov 30, 2022
GeorgeMac added a commit that referenced this pull request Nov 30, 2022
* chore: update CHANGELOG for v1.16.0

* chore: update CHANGELOG with ref to #1179

Co-authored-by: Mark Phelps <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants