1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +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

@ -728,16 +728,18 @@ void TestUtilities::testIsBlockInSight()
void TestUtilities::testColorizeURL()
{
#if USE_CURL
#ifdef HAVE_COLORIZE_URL
#define RED COLOR_CODE("#faa")
#define GREY COLOR_CODE("#aaa")
#define WHITE COLOR_CODE("#fff")
std::string result = colorize_url("http://example.com/");
UASSERT(result == (GREY "http://" WHITE "example.com" GREY "/"));
UASSERTEQ(auto, result, (GREY "http://" WHITE "example.com" GREY "/"));
result = colorize_url(u8"https://u:p@wikipedi\u0430.org:1234/heIIoll?a=b#c");
UASSERT(result ==
UASSERTEQ(auto, result,
(GREY "https://u:p@" WHITE "wikipedi" RED "%d0%b0" WHITE ".org" GREY ":1234/heIIoll?a=b#c"));
#else
warningstream << "Test skipped." << std::endl;
#endif
}