1
0
Эх сурвалжийг харах

fix #275: unescape '+' to space

ithewei 3 жил өмнө
parent
commit
63d81af0fc
2 өөрчлөгдсөн 6 нэмэгдсэн , 3 устгасан
  1. 5 2
      cpputil/hurl.cpp
  2. 1 1
      cpputil/hurl.h

+ 5 - 2
cpputil/hurl.cpp

@@ -77,14 +77,17 @@ std::string HUrl::unescape(const std::string& str) {
             p += 3;
         }
         else {
-            ostr += *p;
+            if (*p == '+') {
+                ostr += ' ';
+            } else {
+                ostr += *p;
+            }
             ++p;
         }
     }
     return ostr;
 }
 
-
 bool HUrl::parse(const std::string& url) {
     reset();
     this->url = url;

+ 1 - 1
cpputil/hurl.h

@@ -10,7 +10,7 @@ public:
     static std::string escape(const std::string& str, const char* unescaped_chars = "");
     static std::string unescape(const std::string& str);
     static inline std::string escapeUrl(const std::string& url) {
-        return escape(url, ":/@?=&#");
+        return escape(url, ":/@?=&#+");
     }
 
     HUrl() : port(0) {}