diff --git a/common/kicad_curl/kicad_curl_easy.cpp b/common/kicad_curl/kicad_curl_easy.cpp index 3a8945ec11..ffeda6b807 100644 --- a/common/kicad_curl/kicad_curl_easy.cpp +++ b/common/kicad_curl/kicad_curl_easy.cpp @@ -142,3 +142,14 @@ bool KICAD_CURL_EASY::SetFollowRedirects( bool aFollow ) } return false; } + + +std::string KICAD_CURL_EASY::Escape( const std::string& aUrl ) +{ + char* escaped = curl_easy_escape( m_CURL, aUrl.c_str(), aUrl.length() ); + + std::string ret( escaped ); + curl_free( escaped ); + + return ret; +} diff --git a/include/kicad_curl/kicad_curl_easy.h b/include/kicad_curl/kicad_curl_easy.h index 729cdd0c51..74dfc90c5d 100644 --- a/include/kicad_curl/kicad_curl_easy.h +++ b/include/kicad_curl/kicad_curl_easy.h @@ -126,6 +126,9 @@ public: return m_buffer; } + /// Escapes a string for use as a URL + std::string Escape( const std::string& aUrl ); + private: /** * Function setOption