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 ignore walking on form mapping (#1942) #1943

Merged
merged 2 commits into from
Nov 1, 2019

Conversation

vkd
Copy link
Contributor

@vkd vkd commented Jun 10, 2019

Now the ignore tag form"-" not allow for the mapping to walk inside that field.
Fix #1942

@codecov
Copy link

codecov bot commented Jun 10, 2019

Codecov Report

Merging #1943 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1943   +/-   ##
=======================================
  Coverage   98.74%   98.74%           
=======================================
  Files          40       40           
  Lines        2236     2236           
=======================================
  Hits         2208     2208           
  Misses         14       14           
  Partials       14       14
Impacted Files Coverage Δ
binding/form_mapping.go 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0f95195...697335b. Read the comment docs.

@thinkerou thinkerou added this to the 1.5 milestone Jun 11, 2019
@thinkerou thinkerou added the bug label Jun 11, 2019
@thinkerou
Copy link
Member

@vkd thanks! may it break backward?

@vkd
Copy link
Contributor Author

vkd commented Jun 11, 2019

Yes, but only in unusual and undocumented cases like this:

type A struct {
	Name string `form:"name"`
}
type S struct {
	A A `form:"-"`
}

var s S
req, _ := http.NewRequest("GET", "/?name=mike", nil)
err := Form.Bind(req, &s)
// s.A.Name == ""
// s.A.Name != "mike"

In my mind (and as I can see by this case: #1942 (comment)), the new way to ignore the whole inner struct by tag form:"-" is more obvious.

@vkd
Copy link
Contributor Author

vkd commented Oct 31, 2019

Let's try to restart the build in the TravisCI.
For me it works.

@thinkerou thinkerou merged commit db9174a into gin-gonic:master Nov 1, 2019
@vkd vkd deleted the fix_1942_ignore_walking branch November 1, 2019 19:03
ThomasObenaus pushed a commit to ThomasObenaus/gin that referenced this pull request Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

request cause panic with v1.4.0 @ form_mapping.go:63 ~ form_mapping.go:89 , be careful
2 participants