Page names lose every letter outside ASCII: Café becomes Caf, a Greek name becomes _
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ó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, php
- Lĩnh vực
- backend, internationalization
Hướng nghiên cứu
Start with validatePagename() in system/core/pages.php:402 and its JavaScript twin in the new page popup; reproduce with the supplied Unicode examples. Read the related lookup and index locations in base.php and index.php, and check the dependencies on #541 and #516. Done means Unicode names are preserved and normalized consistently, lookups and headings handle them, and the reported cases work across page creation, renaming, and settings.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
validatePagename() (system/core/pages.php:402) and its JavaScript twin in the new page popup keep only [\s\d\w\-_]. Without the /u modifier (PHP) or the u flag (JavaScript), \w is ASCII only, so every byte of a letter outside ASCII is removed:
| Typed name | Page name | |
|---|---|---|
Café Ëenhoorn naïef façade |
Caf_enhoorn_naef_faade |
letters lost |
Straße Größe Äpfel |
Strae_Gre_pfel |
|
Café typed decomposed (e + U+0301) |
Cafe |
differs from the precomposed form |
Αθήνα καλημέρα (Greek) |
_ |
the page index then hangs (#514) |
東京都の図書館 |
(empty) | error |
Feest 🎉 👩👩👧 🇳🇱 |
Feest___ |
|
10 km with a non-breaking space |
10km |
words glued |
Été and then été |
t, then "page exists" |
different words collide |
The same function is used for renaming a text page and a mailing list and for the default page in settings. Pages that are made through a link (wikify_link()) do keep their full name, which is inconsistent.
Related: lookups are case-insensitive for ASCII only, because strtolower() does not change É or Α (PHP 8 is locale-independent): hypha_getPage() (base.php:549), the page chooser of the link dialog (pages.php:352: écl does not find Éclair), hypha_getUserByName() (base.php:415) and the sorting in the page index (index.php:51). And index.php:58 takes the first byte of the name as its letter heading.
Steps to reproduce (fictional site, PHP 8.2 container of docs/container): log in, new page, type Café de Kroon, create: the page is Caf_de_Kroon.
Suggested fix (not a small change, so no pull request yet):
- Keep letters, marks and digits of every script:
preg_replace('/[^\p{L}\p{M}\p{N}\s_-]/u', '', $name)in PHP and/[^\p{L}\p{M}\p{N}\s_-]/guin the popup; treat every Unicode space (/\s+/u, which includes the non-breaking space) as a space. - Normalize the name to NFC when the intl extension is there (
Normalizer::normalize()), so precomposed and decomposed input give the same page. - Compare names with
mb_strtolower()(mbstring) in the lookups above. - This needs #541 (percent-decoding of the request path), else such pages give 404, and #516 (#514), else a name that starts with
Émakes the page index hang.
Found while testing Unicode for the Markdown editor (#520). Tested in the PHP 8.2 container of docs/container with a fictional test site: reproduces on main (d97ab7b).
- Ngôn ngữ chính
- JavaScript
- Star
- 5
- Fork
- 9
- Merge trung bình
- 18 giờ 7 phút
- Pull request đã merge (30 ngày)
- 11
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
- Đọ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 PlanBCode/hypha
-
Component: User interface Impact: Low Level: Easy Pagetype: Peer reviewed article Type: Bug Value: Visitors
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Impact: Medium Level: Easy Type: Bug Value: Users
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Impact: Low Level: Easy Pagetype: Festival Type: Bug Value: Coders
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Impact: Medium Level: Easy Pagetype: Mailinglist Type: Bug Value: Users
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Impact: Low Level: Easy Type: Bug Value: Coders
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
PlanBCode/hypha#586 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của PlanBCode/hypha
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
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 82/100
feimacode/open-design-agent-kit#66 ·
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 70/100
xojs/eslint-config-xo#134 ·
-
FEATURE REQUEST
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
linuxmint/cinnamon-spices-extensions#1193 ·
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 80/100
huggingface/transformers.js#1839 ·
Maintainer thường phản hồi trong vòng 1 ngày