Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

A "catch-all" route causes a panic #561

Closed
markbates opened this issue Jul 25, 2017 · 4 comments
Closed

A "catch-all" route causes a panic #561

markbates opened this issue Jul 25, 2017 · 4 comments
Assignees
Milestone

Comments

@markbates
Copy link
Member

app.GET("/{name:.+}", func(c buffalo.Context) error {
	fmt.Println(c.Param("name"))
	return c.Redirect(302, "/")
})
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
github.com/markbates/inflect.(*Ruleset).CamelizeDownFirst(0xc420126e70, 0xc4201cf75b, 0x0, 0x0, 0x0)
	/Users/markbates/Dropbox/development/gocode/src/github.com/markbates/inflect/inflect.go:388 +0xd3
github.com/markbates/inflect.CamelizeDownFirst(0x0, 0x0, 0x0, 0x0)
	/Users/markbates/Dropbox/development/gocode/src/github.com/markbates/inflect/inflect.go:602 +0x41
github.com/gobuffalo/buffalo.buildRouteName(0x47d4e1f, 0xa, 0x1, 0x1)
	/Users/markbates/Dropbox/development/gocode/src/github.com/gobuffalo/buffalo/router.go:219 +0x67b
github.com/gobuffalo/buffalo.(*App).addRoute(0xc4201477a0, 0x47ce1cd, 0x3, 0x47d4e1f, 0xa, 0x47f7da0, 0x0)
	/Users/markbates/Dropbox/development/gocode/src/github.com/gobuffalo/buffalo/router.go:170 +0x3fe
github.com/gobuffalo/buffalo.(*App).GET(0xc4201477a0, 0x47d4e1f, 0xa, 0x47f7da0, 0x0)
	/Users/markbates/Dropbox/development/gocode/src/github.com/gobuffalo/buffalo/router.go:16 +0x5e
github.com/markbates/coke/actions.App(0x47ceaba)
	/Users/markbates/Dropbox/development/gocode/src/github.com/markbates/coke/actions/app.go:62 +0x38f
main.main()
	/Users/markbates/Dropbox/development/gocode/src/github.com/markbates/coke/main.go:12 +0x68
@markbates markbates added this to the 0.9.3 milestone Jul 25, 2017
@paganotoni
Copy link
Member

paganotoni commented Jul 26, 2017

@markbates what do you think should be the name of that route ?

@markbates
Copy link
Member Author

I would call it "unnamed". If a second one comes in "unnamed2", etc…

@paganotoni
Copy link
Member

ok, i will just name the route "unnamed" as we discussed on Slack, if there is another route with the same shape it would override this one, so it should have the same name.

@paganotoni
Copy link
Member

closed by #562

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants