Commit 7d9e370
fix: prevent 2-letter folder names from being misidentified as locale codes
getPagePath() used a regex to extract locale prefixes from file paths, but
any top-level folder with a 2-letter name (e.g. AI/, CI/) or 2+2-letter
hyphenated name (e.g. CI-CD/) matched the BCP 47 locale pattern, causing
the extracted non-existent locale to violate the pages_localecode_foreign
FK constraint on insert.
Now validates the extracted locale against the configured locales
(WIKI.config.lang.code + WIKI.config.lang.namespaces) before accepting it.
Cherry-picked from requarks/wiki requarks#79581 parent 1c576a3 commit 7d9e370
1 file changed
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
147 | | - | |
148 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
149 | 156 | | |
150 | 157 | | |
151 | 158 | | |
| |||
0 commit comments