Commit 4ac103a
Treat prefix literally in UrlTemplate.match(url, prefix) (#17713)
* Treat prefix literally in UrlTemplate.match(url, prefix)
match(url, prefix) strips the prefix with matchAgainst.replaceFirst(prefix,
""), which interprets the prefix as a regular expression. A prefix that
contains regex metacharacters (for example an unmatched ( ) throws
PatternSyntaxException, or silently strips the wrong text.
Quote the prefix with Pattern.quote so it is matched literally.
* Complete Javadoc for UrlTemplate.match(matchAgainst, prefix)
---------
Co-authored-by: Diego Molina <diemol@users.noreply.github.com>1 parent 78bbfff commit 4ac103a
2 files changed
Lines changed: 20 additions & 3 deletions
File tree
- java
- src/org/openqa/selenium/remote/http
- test/org/openqa/selenium/remote/http
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
145 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
146 | 152 | | |
147 | 153 | | |
148 | 154 | | |
149 | 155 | | |
150 | 156 | | |
151 | 157 | | |
152 | | - | |
| 158 | + | |
153 | 159 | | |
154 | 160 | | |
155 | 161 | | |
| |||
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
99 | 110 | | |
0 commit comments