Commit 76cc677
committed
Be more cautious when guessing language from filename
Use more strict validation when attempting to interpret part of filename
as language code. Don't try to parse things that don't look like
language tags, because Language::TryParse() is too permissive.
A particular failure mode is that ICU attempts to parse a language tag
in a way where a string with-many-components-like-this may be
interpreted as a valid language with e.g. nonsense country or variants.1 parent b879c9f commit 76cc677
2 files changed
Lines changed: 22 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| |||
324 | 327 | | |
325 | 328 | | |
326 | 329 | | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
327 | 335 | | |
328 | 336 | | |
329 | 337 | | |
| |||
636 | 644 | | |
637 | 645 | | |
638 | 646 | | |
639 | | - | |
| 647 | + | |
| 648 | + | |
640 | 649 | | |
641 | 650 | | |
642 | 651 | | |
| |||
663 | 672 | | |
664 | 673 | | |
665 | 674 | | |
666 | | - | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
667 | 678 | | |
668 | 679 | | |
669 | 680 | | |
670 | 681 | | |
671 | | - | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
672 | 685 | | |
673 | 686 | | |
674 | 687 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
187 | 193 | | |
188 | 194 | | |
189 | 195 | | |
| |||
0 commit comments