Rewrite srcset attributes inside wicket:link

Đang mở
#1,952 2 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

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

Từ ngày 21/11/2026.

  • #1977 của @aryankalantri — đang mở
  • #1986 của @abduladnan-mt7 — đ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
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
web-dev

Hướng nghiên cứu

Read RelativePathPrefixHandler.java, especially the attributeNames array and its use, then check the auto-link resolver for how src is handled. Add coverage beside the existing tests in RelativePathPrefixHandlerTest.java for srcset on img and source. Done means relative URLs are rewritten while each descriptor is preserved.

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

Mô tả

good first issue

Inside <wicket:link> (and for relative paths in general), Wicket rewrites the URLs in href, src and background attributes so they resolve relative to the page's package. The srcset attribute of <img> and <source> is not rewritten, so responsive images in static markup break.

Where

wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/RelativePathPrefixHandler.java, the attributeNames array and the code that uses it. Check also how <wicket:link> resolves src (the auto-link resolver) to see whether srcset needs handling there too.

srcset is not a single URL but a comma-separated list of url descriptor pairs, for example small.jpg 480w, large.jpg 1080w. Each URL needs rewriting and the descriptors must be kept.

Done when

  • Relative URLs in srcset on <img> and <source> are rewritten the same way as src, with the descriptors kept.
  • Tests next to the existing ones in wicket-core-tests/src/test/java/org/apache/wicket/markup/parser/RelativePathPrefixHandlerTest.java.

Background

Originally reported as WICKET-6326 (Wicket 8.0).


Part of #1945. This issue is meant for a first contribution to Wicket. To work on it, leave a comment so others know; a claim without a pull request lapses after two weeks. Questions are welcome, here on the issue or on [email protected]. Start your branch from master, and see Send a pull request to Wicket for building and testing.

Ngôn ngữ chính
Java
Star
800
Fork
437
Merge trung bình
21 giờ 36 phút
Pull request đã merge (30 ngày)
167

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: 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 apache/wicket

Tất cả issue của apache/wicket

Issue tương tự

Thêm issue về Java

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.