Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Unclear behaviour of `*` in routes

Đang mở
#2,619 9 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@aldas đang làm issue này rồi.

Từ ngày 6/4/2024.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

feature router
Issue Description
Checklist
  • Dependencies installed
  • No typos
  • Searched existing issues and docs
Expected behaviour
  • If I have static text in a route that static text is guaranteed to show up in c.Path() or c.Request().RequestURI
  • Multiple instances of * in routes play nicely with each other
Actual behaviour
  • If I have static text in a route, another route with * may "absorb it"
  • Multiple instances of * in routes do NOT seem to play nicely with each other
Steps to reproduce

Trying to build router for: https://github.com/opencontainers/distribution-spec/blob/main/spec.md

handler := func (c echo.Context) err {
  fmt.Printf("%s\n", c.Path())
}

e := echo.New()
v2 := e.Group("/v2")

v2.DELETE("/*/blobs/:digest", handler)
v2.GET("/*/blobs/:digest", handler)
v2.HEAD("/*/blobs/:digest", handler)

v2.DELETE("/*/manifests/:ref", handler)
v2.GET("/*/manifests/:ref", handler)
v2.HEAD("/*/manifests/:ref", handler)
v2.PUT("/*/manifests/:ref", handler)

v2.GET("/*/tags/list", handler)

v2.GET("/*/blobs/uploads/:ref", handler)
v2.PATCH("/*/blobs/uploads/:ref", handler)
v2.POST("/*/blobs/uploads", handler)
v2.PUT("/*/blobs/uploads/:ref", handler)

v2.GET("", handler)

Run:

curl -ik  https://localhost:8080/v2/foo/bar/baz/tags/list

# /v2/*/blobs/uploads/:ref

Result outputs /v2/*/blobs/uploads/:ref when it should output /v2/*/tags/list.

Version/commit

v4.11.4

Ngôn ngữ chính
Go
Star
32.7k
Fork
2.8k
Merge trung bình
9 giờ 39 phút
Pull request đã merge (30 ngày)
6

Chuẩn bị môi trường

Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của labstack/echo

Tất cả issue của labstack/echo

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.