echo-swagger icon indicating copy to clipboard operation
echo-swagger copied to clipboard

There are repeated slashes when jumping to index

Open hungtcs opened this issue 2 years ago • 2 comments

The regular match contains a slash, but an extra slash is spliced below.

https://github.com/swaggo/echo-swagger/blob/56020475d07fb7bc62e0efe48e8bb97ac88b758b/swagger.go#L131-L164

So if you access the path /swagger/, you will get /swagger//index.html

hungtcs avatar Dec 10 '23 02:12 hungtcs

This is my workaround FWIW:

swaggerRedirect := func(c echo.Context) error {
    return c.Redirect(http.StatusMovedPermanently, "/api/v1/doc/index.html")
}
e.GET("/api/v1/doc", swaggerRedirect)
e.GET("/api/v1/doc/", swaggerRedirect)
e.GET("/api/v1/doc/*", echoSwagger.WrapHandler)

evan-goode avatar Feb 23 '24 19:02 evan-goode

I have same problem. I'm going to look to the gin side...

kripsy avatar Apr 27 '24 17:04 kripsy