fix decoder bug

This commit is contained in:
Looly 2023-04-18 16:35:29 +08:00
parent 91de866ffa
commit ce1c0bab45

View File

@ -88,11 +88,6 @@ public class URLDecoder implements Serializable {
char c;
for (int i = 0; i < length; i++) {
c = str.charAt(i);
if('+' == c){
result.append(isPlusToSpace ? CharUtil.SPACE : c);
begin++;
continue;
}
if(ESCAPE_CHAR == c || CharUtil.isHexChar(c)){
continue;
}
@ -103,6 +98,11 @@ public class URLDecoder implements Serializable {
result.append(decodeSub(str, begin, i, charset, isPlusToSpace));
}
// 非Hex字符忽略本字符
if('+' == c && isPlusToSpace){
c = CharUtil.SPACE;
}
// 非Hex字符忽略本字符
result.append(c);
begin = i + 1;