Domain mapping fix_srcset applies the request's mapped domain to other sites' images after switch_to_blog
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 62/100
Hướng nghiên cứu
Lỗi nằm ở fix_srcset() trong inc/class-domain-mapping.php, được gắn vào wp_calculate_image_srcset, và thiếu bước kiểm tra blog ID mà mangle_url() đã thực hiện. So sánh hai phương thức, sau đó thêm một lệnh return sớm khi blog ID của current_mapping khác với get_current_blog_id(). Cũng kiểm tra các filter trong register_mapped_filters() xem có cùng lỗ hổng này không. Hoàn thành khi việc render ảnh của site khác bằng switch_to_blog() nhận được các URL srcset riêng, và ảnh trên site đã ánh xạ vẫn giữ domain đã ánh xạ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
Domain_Mapping::fix_srcset() (inc/class-domain-mapping.php, hooked on wp_calculate_image_srcset) rewrites every srcset URL with replace_url() using $this->current_mapping, the mapping of the request's host. Unlike mangle_url(), which returns early when $current_mapping->get_blog_id() !== get_current_blog_id(), fix_srcset() has no site check.
So when a request for mapped site A calls switch_to_blog(B) and renders B's images, B's srcset URLs get A's domain (https://site-a.example/app/uploads/sites/B/...), while src stays correct. On a production network (2026-11-21) this was cached in Elementor's _elementor_element_cache for four posts of one site. A CDN page-URL rewriter then replaced only the upload path, leaving A's host in front of the CDN URL (https://site-a.examplehttps://cdn.example/...), so the logo, banners and product images failed to load on every page of site B.
Fix
In fix_srcset(), return $sources unchanged unless $this->current_mapping->get_blog_id() === get_current_blog_id(), matching mangle_url(). Optionally, use the mapping for the current blog instead of returning early. Check the other filters registered in register_mapped_filters() for the same missing guard.
Files Scope
- EDIT:
inc/class-domain-mapping.php(fix_srcset(), around line 705)
Verification
- On a multisite with a mapped domain for site A, request A's front end with code that runs
switch_to_blog(B); echo wp_get_attachment_image($id_on_B, 'full'); restore_current_blog();. Before the fix, srcset URLs use A's domain; after it, they use B's own URLs. - Regression: images rendered on A itself still get A's mapped domain in srcset.
aidevops.sh v3.39.189 plugin for OpenCode
- Ngôn ngữ chính
- PHP
- Star
- 219
- Fork
- 88
- Merge trung bình
- 1 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 58
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Ultimate-Multisite/ultimate-multisite
-
bug hold-for-review no-auto-dispatch origin:interactive status:available
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 20/100
Ultimate-Multisite/ultimate-multisite#2140 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement hold-for-review no-auto-dispatch origin:interactive status:available
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
Ultimate-Multisite/ultimate-multisite#2137 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fix: customer site lists stop at 100 sites (BerlinDB default number)Có thể đã có người làm @superdav42 đã nhận hôm nay. Đang mởauto-dispatch bug origin:interactive status:in-review tier:standard
Ultimate-Multisite/ultimate-multisite#2136 · 5 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fix: My Sites, Limits and Current Membership columns above 3 collapse to one column (missing grid utilities)Có thể đã có người làm @superdav42 đã nhận hôm nay. Đang mởauto-dispatch bug origin:interactive status:in-review tier:standard
Ultimate-Multisite/ultimate-multisite#2134 · 5 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
security(sso): apply mapped-domain token policy to admin-bar magic linksCó thể đã có người làm @superdav42 đã nhận 1 ngày trước. Đang mởauto-dispatch origin:interactive status:in-review tier:standard
Ultimate-Multisite/ultimate-multisite#2125 · 5 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Ultimate-Multisite/ultimate-multisite
Issue tương tự
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
quantum-php/framework#692 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
ajeetraina/awesome-docker-sbx#559 ·
-
dependencies enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
novalo-dev/Prestashop-MCP-Server#329 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày