-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Using / in Wiki Title break the wiki #2869
Comments
Step to reproduce bug:
|
Had a quick look at this and it seems the route is matched on an unescaped path (A feature of the framework?). So a request to |
This is also happening for paths with parenthesis in them, ie., |
It should be related with routes. |
@lunny I briefly took a look at their docs: https://go-macaron.com/docs/middlewares/routing Should we use a regex instead? Not sure why that URL-encoded string is not being handled the way that we want it (this is just from a few mins of looking at the code and haven't worked with macaron before, but...) |
This is the correct router group for the wiki right? https://github.com/go-gitea/gitea/blob/master/routers/routes/routes.go#L596 |
I'm also wondering why it is that parentheses are not being handled... It feels like I'm missing something pretty fundamental about how Macaron parses routes... |
Okay, so not saying I've got anything conclusive here, but I decided to test out macaron independently by running with the following little go file: package main
import (
"gopkg.in/macaron.v1"
)
func main() {
m := macaron.Classic()
m.Get("/foobar/:filename/hello",
func(ctx *macaron.Context) string {
return "You got it!"
},
)
m.Run()
} After starting that server (running on 0.0.0.0:4000 on my laptop), I tried out the following calls:
So it's looking like there's an issue with Macaron here... @lunny What are your thoughts here? I spent a few mins looking through the macaron code (looks pretty simple), but I noticed you're not a contributor there... From my work that I've outlined here so far, it seems that we have two options:
And, it's probably worth a deeper look if a bug like this has implications elsewhere in Gitea... I'm no expert on the Gitea codebase, but this sort of a routing issue could definitely have pretty far-reaching implications... |
@svarlamov Thanks for your investigate, that's what I guess. Maybe you can send an issue or PR on Macaron and @unknwon is the owner of Macaron. |
@lunny Sounds good. I will have a look there and maybe I will be able to create a PR instead of just an issue! 😛 Is the plan to stick with Macaron as the framework? It seems like it's a holdover from the gogs project... I'm a bit nervous to be running that in production -- would be cleaner to have gorilla mux or something like that... I assume you all have considered that? In the meantime, are you okay to set the default route the Wiki HTML template though? I'm keen to contribute and get involved with this project :) |
@svarlamov some maintainers suggested Gin instead of Macaron, but it seems that needs many work and maybe cause Gitea unstable. You are welcome to contribute to Gitea, please read CONTRIBUTING at first. And you can discuss about web framework or any plan on #develop channel on our discord server. |
I like go-chi router as it uses GoLang context features |
@svarlamov I've created a PR to fix the problem in macaron: go-macaron/macaron#149 |
@ethantkoenig Thank you for the PR there, looking good... Hopefully @unknwon will be around to merge it there shortly 😄 |
@ethantkoenig go-macaron PR has been merged 👍 |
In This Wiki Url For example it just show the Raw Markdown instead of the markdown with Gitea Layout.
The text was updated successfully, but these errors were encountered: