~p treats routes as static when they only start with a static directory name

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

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

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

Từ ngày 3/11/2026.

  • #6896 của @mandar1045 — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
30/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
elixir
Lĩnh vực
backend

Hướng nghiên cứu

Read the ~p static-path handling and compare its matching behavior with Plug.Static's :only semantics. Check how router verification, static_url, and path_prefixes behave for paths such as /images-gallery versus /images/logo.png; done means only paths within a static directory are treated as static. Linked pull request #6896 is already open.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Environment
  • Phoenix version: main (also 1.8.x)
Actual behavior

~p checks if a path is static with String.starts_with?, so with the default
statics: ~w(assets fonts images favicon.ico robots.txt) a route like
~p"/images-gallery" is treated as a static file. Because of that:

  • it's not verified against the router, so typos don't warn
  • url(~p"/images-gallery") uses static_url, so with a CDN set up it points to
    https://cdn.example.com/images-gallery
  • path_prefixes are skipped for it
Expected behavior

Only paths inside a static directory, like /images/logo.png, should count as
static, same as Plug.Static's :only which matches the whole first segment.

Ngôn ngữ chính
Elixir
Star
23.2k
Fork
3.2k
Merge trung bình
16 giờ 35 phút
Pull request đã merge (30 ngày)
18

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

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 phoenixframework/phoenix

Tất cả issue của phoenixframework/phoenix

Issue tương tự

Thêm issue về Elixir

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.