FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Also replace + by space in urlDecode · lalittech/esp32_https_server@e7eaf28 · GitHub

Repository navigation

Commit e7eaf28

Browse files
committed
Also replace + by space in urlDecode
1 parent f9513ac commit e7eaf28

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎src/util.cpp‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,14 @@ std::string intToString(int i) {
6161

6262
std::string urlDecode(std::string input) {
6363
std::size_t idxReplaced = 0;
64-
std::size_t idxFound = input.find('%');
64+
// First replace + by space
65+
std::size_t idxFound = input.find('+');
66+
while (idxFound != std::string::npos) {
67+
input.replace(idxFound, 1, 1, ' ');
68+
idxFound = input.find('+', idxFound);
69+
}
70+
// Now replace percent-escapes
71+
idxFound = input.find('%');
6572
while (idxFound != std::string::npos) {
6673
if (idxFound <= input.length() + 3) {
6774
char hex[2] = { input[idxFound+1], input[idxFound+2] };

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL