Reader search drops everything after an & in the search phrase
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
- 83/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ệ
- ios, objective-c
- Lĩnh vực
- mobile
Hướng nghiên cứu
Đọc Modules/Sources/WordPressKitObjC/ReaderPostServiceRemote.m và ReaderPostServiceRemoteTests.m, bắt đầu với endpointUrlForSearchPhrase: và testEndpointUrlForSearchPhrase. Cập nhật bài kiểm thử để mong đợi dấu và được mã hóa trong giá trị truy vấn, rồi xác minh bằng NSURLComponents rằng q là mục truy vấn duy nhất và chứa toàn bộ cụm từ. Issue hoàn tất khi các kiểm tra đó thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Reader search drops everything after an & in the search phrase. Searching for "coffee & cake" returns the same results as searching for "coffee ".
What happens
ReaderPostServiceRemote endpointUrlForSearchPhrase: puts the phrase into the URL with wp_stringByUrlEncoding. That helper encodes with URLQueryAllowedCharacterSet, which leaves & as it is. So the & ends the q parameter:
| Phrase | Request | What the server gets |
|---|---|---|
coffee & cake |
read/search?q=coffee%20&%20cake |
q = "coffee ", plus a stray parameter named " cake" |
coffee |
read/search?q=coffee |
q = "coffee" |
The existing test testEndpointUrlForSearchPhrase in ReaderPostServiceRemoteTests.m asserts exactly this output (hasSuffix:@"q=coffee%20&%20cake"), so it passes today.
Evidence
Checked on 2026-10-27:
-
Encoding. A probe running the same code as
wp_stringByUrlEncodingproducedq=coffee%20&%20cake.NSURLComponentsthen readsqas "coffee ", with 2 query items. -
Server.
GET /rest/v1.2/read/search?number=5&q=…:qsentResults coffee%20&%20cake(what the app sends)identical to coffee%20coffee%20— coffee%20%26%20cake(correctly encoded)different posts -
+is not affected in practice:c++,c%20%20andc%2B%2Breturn the same results.
Checked in the app: "coffee & cake" and "coffee" return identical results. Screenshots are in the first comment.
Steps to reproduce
- Reader → Search.
- Search for
coffee & cakeand note the posts. - Search for
coffeeand compare.
Expected: different results, matching posts about coffee and cake.
Actual: the same results as coffee.
Fix
Encode the phrase as a query value in endpointUrlForSearchPhrase: (Modules/Sources/WordPressKitObjC/ReaderPostServiceRemote.m). Don't change wp_stringByUrlEncoding itself, because PeopleServiceRemote uses it to encode whole avatar URLs, where & must stay as it is.
NSMutableCharacterSet *allowed = [[NSCharacterSet URLQueryAllowedCharacterSet] mutableCopy];
[allowed removeCharactersInString:@"&+=#"];
NSString *query = [phrase stringByAddingPercentEncodingWithAllowedCharacters:allowed];
NSString *endpoint = [NSString stringWithFormat:@"read/search?q=%@", query];
The endpoint string is also the search topic's path, its lookup key. Saved searches for phrases containing & will get a new topic, which is fine.
Tests
In ReaderPostServiceRemoteTests.m, testEndpointUrlForSearchPhrase:
- Change the
coffee & cakeassertion to expectq=coffee%20%26%20cake. - Add a check that the URL's
qquery item, read withNSURLComponents, is exactlycoffee & cake, and that it's the only query item. This fails on trunk.
Related: found while planning #6632, which adds a lang parameter to the same URL.
- Ngôn ngữ chính
- Swift
- Star
- 3.9k
- Fork
- 1.2k
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 136
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- 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 wordpress-mobile/WordPress-iOS
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
wordpress-mobile/WordPress-iOS#26423 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Pri] Low [Status] Ready for Dev [Type] Bug /Me
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
wordpress-mobile/WordPress-iOS#26279 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Pri] Low [Status] Ready for Dev [Type] Bug Share Extension
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
wordpress-mobile/WordPress-iOS#26276 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Pri] Low [Status] Ready for Dev [Type] Bug Blogging Prompts Notifications
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
wordpress-mobile/WordPress-iOS#26256 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Type] Bug Posts + Pages UI
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
wordpress-mobile/WordPress-iOS#26232 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của wordpress-mobile/WordPress-iOS
Issue tương tự
-
Optional callbacks log "Unable to create JSCallback" when passed nullCó thể đã có người làm @cmsj đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
cmsj/Hammerspoon2#464 ·
-
android bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
VocaHQ/vocaphone#470 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
new-compilers request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
compiler-explorer/compiler-explorer#9640 ·
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 62/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100