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: edge case where empty value overwrite existing value #87

Merged
merged 8 commits into from
Jan 25, 2023

Conversation

xprotocol-bot
Copy link
Contributor

Reason for This PR

We found another edge case where http package can potentially wrongly overwrite data

Let's say that we have a form like this:

form := url.Values{}
form.Add("name[]", "name1")
form.Add("name[]", "name2")
form.Add("name[]", "name3")
form.Add("name", "")

Because iterating over map in Go is random so this case might not happen all the time. But when it happens,
data under name key will be empty string which in our case removes all the relationships in Laravel backpack.

I also refactor the test cases to be shorter and with better description.

Description of Changes

Fix one more edge case where empty value can potentially overwrite existing value.

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the MIT license.

PR Checklist

  • All commits in this PR are signed (git commit -s).
  • The reason for this PR is clearly provided (issue no. or explanation).
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this PR.
  • Any user-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.

@rustatian rustatian self-requested a review January 23, 2023 16:58
@rustatian rustatian added the bug Something isn't working label Jan 23, 2023
@rustatian
Copy link
Member

Hey 👋🏻, great work @tungfinblox, thanks 👍🏻
I'll have a look tomorrow ⚡

@rustatian
Copy link
Member

rustatian commented Jan 24, 2023

Everything else looks good (mmm generics 😆), nice job, thanks 👍🏻

@xprotocol-bot
Copy link
Contributor Author

Everything else looks good (mmm generics laughing), nice job, thanks 👍🏻

Thank you. I updated it :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants