mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-28 05:49:35 +00:00
+ fix escaping character (%) parser in url parsing
This commit is contained in:
@ -27,11 +27,10 @@ static char charFromHex(std::string a) {
|
||||
}
|
||||
|
||||
void unescapeUrl(string &url) {
|
||||
std::string::size_type pos;
|
||||
std::string hex;
|
||||
while (std::string::npos != (pos = url.find('%'))) {
|
||||
hex = url.substr(pos + 1, 2);
|
||||
url.replace(pos, 3, 1, charFromHex(hex));
|
||||
std::string::size_type pos = 0;
|
||||
while ((pos = url.find('%', pos + 1)) != std::string::npos &&
|
||||
pos + 3 <= url.length()) {
|
||||
url.replace(pos, 3, 1, charFromHex(url.substr(pos + 1, 2)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user