Skip to content

Commit

Permalink
fix echo route (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
drewhammond authored Oct 21, 2022
1 parent ea5c8b3 commit 643757d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions internal/app/ui/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (s *Service) RegisterRoutes() {
router.GET("/cookbooks/:name", s.getCookbook)
router.GET("/cookbooks/:name/:version", s.getCookbookVersion)
router.GET("/cookbooks/:name/:version/files", s.getCookbookFiles)
router.GET("/cookbooks/:name/:version/file/*trail", s.getCookbookFile)
router.GET("/cookbooks/:name/:version/file/*", s.getCookbookFile)
router.GET("/cookbooks/:name/:version/recipes", s.getCookbookRecipes)

router.GET("/groups", s.getGroups)
Expand Down Expand Up @@ -300,8 +300,7 @@ func (s *Service) getCookbookRecipes(c echo.Context) error {
func (s *Service) getCookbookFile(c echo.Context) error {
name := c.Param("name")
version := c.Param("version")
// *trail always contains a leading slash apparently
path := strings.TrimPrefix(c.Param("trail"), "/")
path := c.Param("*")
cookbook, err := s.chef.GetCookbookVersion(c.Request().Context(), name, version)
if err != nil {
return c.Render(http.StatusNotFound, "errors/404", echo.Map{
Expand Down

0 comments on commit 643757d

Please sign in to comment.