1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

Fix curl compatibility issues with colorize_url (#14615)

Also move the escape code safety check to guiOpenURL.
This commit is contained in:
sfan5 2024-05-09 11:31:10 +02:00 committed by GitHub
parent 780543f0a2
commit 59bf1d8cd9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 36 additions and 20 deletions

View file

@ -23,11 +23,19 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define COLOR_CODE(color) "\x1b(c@" color ")"
#if USE_CURL
#include <curl/curlver.h>
// curl_url functions since 7.62.0
#if LIBCURL_VERSION_NUM >= 0x073e00
#define HAVE_COLORIZE_URL
#endif
#endif
#ifdef HAVE_COLORIZE_URL
/**
* Colorize URL to highlight the hostname and any unsafe characters
* Colorize URL to highlight the hostname and any unsafe characters.
*
* Throws an exception if the url is invalid
* Throws an exception if the url is invalid.
*/
std::string colorize_url(const std::string &url);