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

feat(routes): Catch-All form should not include the slash before param #1061

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

easonlin404
Copy link
Contributor

@easonlin404 easonlin404 commented Aug 12, 2017

Fix #279. Base on 42e0c82 work.

@codecov
Copy link

codecov bot commented Aug 13, 2017

Codecov Report

Merging #1061 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1061      +/-   ##
==========================================
+ Coverage   96.65%   96.66%   +<.01%     
==========================================
  Files          16       16              
  Lines        1706     1707       +1     
==========================================
+ Hits         1649     1650       +1     
  Misses         49       49              
  Partials        8        8
Impacted Files Coverage Δ
tree.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 211c48f...cb7fde2. Read the comment docs.

@tboerger
Copy link
Contributor

This will potentially break installations that already rely on this behavior

@appleboy appleboy added this to the 1.3 milestone Aug 26, 2017
Copy link
Member

@javierprovecho javierprovecho left a comment

Choose a reason for hiding this comment

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

I agree with @tboerger , I've faced this sometimes. However I always stripped the / using https://golang.org/pkg/strings/#TrimPrefix which is much more secure. Using path[1:] carries much more risk, because it trims whatever is the first char.

I'm not sure, yet.

EDIT: a notice on version changelog in bold BREAKING would help? it's a one line fix for broken behavior

@easonlin404
Copy link
Contributor Author

Maybe add path[1:] condition to determine if the first char is / to reduce usage risk ?

For breakdown api, add BREAKING doc LGTM and can wait #1084 discussing to get future steps. 😄

@ashtonian
Copy link

ashtonian commented Jul 17, 2019

what needs to be done to merge this, is it just the tests or is there another reason?

This breaks the binding functionality for optional parameters.

@ashtonian
Copy link

since its been 2 years since this PR was submitted, would you be open to change it to be a configurable option based on a variable somewhere? If so where would I add that variable ? maybe get it via env once on init or something?

TRIM_WILDCARD_SLASH := false // TODO: move me and make me configurable 
...
		} else if TRIM_WILDCARD_SLASH && path[1:1] == "/" {
						value.params[i].Value = path[1:]
                }
...

@thinkerou thinkerou modified the milestones: 1.5, 1.6 Oct 27, 2019
@percona-csalguero
Copy link

Any news on this issue?

@thinkerou
Copy link
Member

@appleboy we need to merge the PR to v1.6?

@appleboy
Copy link
Member

Move to v1.7 milestone?

@appleboy appleboy removed this from the 1.6 milestone Feb 28, 2020
@appleboy appleboy added this to the 1.x milestone Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

the Catch-All form should not include the "/" before param
7 participants