Repository navigation
Commit b5d2748
committed
fix(shared): correct ifemp match when following literal begins with '='
UriTemplate.match() misparsed a ';' (ifemp) capture whose non-empty
value collided with the following literal that begins with '='. In
_scan_prefix, uri.startswith(nxt.text, pos) was checked before
uri[pos] == '=', so a value equal to the stem of that literal (e.g.
{;a}=end{+rest} with a="end" -> ";a=end=end/x") was read as empty and
the duplicate "=end" leaked into the greedy capture.
Prefer the value form: when a '=' follows the name, locate the
following literal after a value within the operator's stop-char window;
only fall back to the empty-value (startswith) check when no boundary is
found. The suffix / no-greedy path was already correct and is unchanged.
Adds test_match_prefix_ifemp_value_collides_with_eq_literal covering the
collision plus boundary cases: empty value before an '=' literal, a
non-colliding value, name-continuation rejection, and the no-greedy
round-trip.
Closes #38521 parent 77001c9 commit b5d2748
2 files changed
Lines changed: 56 additions & 13 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1079 | 1079 | | |
1080 | 1080 | | |
1081 | 1081 | | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
1085 | 1102 | | |
1086 | | - | |
1087 | | - | |
1088 | | - | |
1089 | 1103 | | |
1090 | 1104 | | |
1091 | | - | |
1092 | | - | |
1093 | | - | |
1094 | | - | |
1095 | | - | |
1096 | | - | |
1097 | | - | |
| 1105 | + | |
1098 | 1106 | | |
1099 | 1107 | | |
1100 | 1108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
747 | 747 | | |
748 | 748 | | |
749 | 749 | | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
750 | 785 | | |
751 | 786 | | |
752 | 787 | | |
| |||
0 commit comments