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

router "/aa/:name" can match "/aa.xml/aa.xml" #4946

Closed
runner361 opened this issue May 17, 2022 · 4 comments · Fixed by #4958
Closed

router "/aa/:name" can match "/aa.xml/aa.xml" #4946

runner361 opened this issue May 17, 2022 · 4 comments · Fixed by #4958
Labels
activity/weopen-star kind/bug Definite and accepted bugs

Comments

@runner361
Copy link
Contributor

if strings.HasSuffix(seg, str) && strings.HasSuffix(treePattern, seg) {

This modification is still not sufficient,for router “/v1/yangeryl/:name” url like "/v1/yangeryl.xml/yangeryl.xml" can also be matched
image

@flycash
Copy link
Collaborator

flycash commented May 18, 2022

This was fixed, you can upgrade the Beego version

@runner361
Copy link
Contributor Author

Both v2.0.2 and v1.12.4 have this problem ,and I know your fix about "pick the fix 4459: /abc.html/aaa match /abc/aaa"
but the modification is still not sufficient, for router "/v1/aa/bb/:name" ,url "/v1/aa.xml/bb/aa.xml" can also be matched. The key here is keep the last ":name"(aa.xml) and the fix route(aa) with “.xml .json .html” suffix the same.

@flycash
Copy link
Collaborator

flycash commented May 19, 2022

Sorry I am busy now, so can you help to fix this?

@flycash flycash added the kind/bug Definite and accepted bugs label May 19, 2022
runner361 added a commit to runner361/beego that referenced this issue May 20, 2022
@flycash flycash linked a pull request May 20, 2022 that will close this issue
runner361 added a commit to runner361/beego that referenced this issue May 21, 2022
Test for fix of issue 4946,  beego#4946
runner361 added a commit to runner361/beego that referenced this issue May 21, 2022
@runner361
Copy link
Contributor Author

OK,issue was fixed

@flycash flycash linked a pull request May 23, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
activity/weopen-star kind/bug Definite and accepted bugs
Projects
None yet
2 participants