Page names lose every letter outside ASCII: Café becomes Caf, a Greek name becomes _
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, php
- Ambito
- backend, internationalization
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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).
- Lingua principale
- JavaScript
- Stelle
- 5
- Fork
- 9
- Merge medio
- 18h 7m
- PR unite (30g)
- 11
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PlanBCode/hypha
-
Component: User interface Impact: Low Level: Easy Pagetype: Peer reviewed article Type: Bug Value: Visitors
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Impact: Medium Level: Easy Type: Bug Value: Users
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Impact: Low Level: Easy Pagetype: Festival Type: Bug Value: Coders
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Impact: Medium Level: Easy Pagetype: Mailinglist Type: Bug Value: Users
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
Impact: Low Level: Easy Type: Bug Value: Coders
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
PlanBCode/hypha#586 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di PlanBCode/hypha
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
feimacode/open-design-agent-kit#66 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
xojs/eslint-config-xo#134 ·
-
FEATURE REQUEST
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
linuxmint/cinnamon-spices-extensions#1193 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
huggingface/transformers.js#1839 ·
I maintainer di solito rispondono entro 1 giorno