Fix inefficient loop in QueryStringDecoder.decodeComponent()
- Fixes #2228 - There's no point of looping until the end of the component if at least one '%' or '+' is found.
This commit is contained in:
parent
6c02e19d10
commit
c73e1e3c1e
@ -311,13 +311,9 @@ public class QueryStringDecoder {
|
|||||||
boolean modified = false;
|
boolean modified = false;
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
final char c = s.charAt(i);
|
final char c = s.charAt(i);
|
||||||
switch (c) {
|
if (c == '%' || c == '+') {
|
||||||
case '%':
|
modified = true;
|
||||||
i++; // We can skip at least one char, e.g. `%%'.
|
break;
|
||||||
// Fall through.
|
|
||||||
case '+':
|
|
||||||
modified = true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!modified) {
|
if (!modified) {
|
||||||
|
Loading…
Reference in New Issue
Block a user