mirror of https://github.com/kiwix/libkiwix.git
+ fix escaping character (%) parser in url parsing
This commit is contained in:
parent
5d8593805f
commit
58f30fd0e5
|
@ -27,11 +27,10 @@ static char charFromHex(std::string a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void unescapeUrl(string &url) {
|
void unescapeUrl(string &url) {
|
||||||
std::string::size_type pos;
|
std::string::size_type pos = 0;
|
||||||
std::string hex;
|
while ((pos = url.find('%', pos + 1)) != std::string::npos &&
|
||||||
while (std::string::npos != (pos = url.find('%'))) {
|
pos + 3 <= url.length()) {
|
||||||
hex = url.substr(pos + 1, 2);
|
url.replace(pos, 3, 1, charFromHex(url.substr(pos + 1, 2)));
|
||||||
url.replace(pos, 3, 1, charFromHex(hex));
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue