From 12210cb99c1a508c822936ac7d8e7ddeea8590e3 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 26 Jul 2021 18:58:22 +0100 Subject: [PATCH] [Minor] Do not advance iterator --- src/libserver/html/html.cxx | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx index 97a8640c52..1d8206bbab 100644 --- a/src/libserver/html/html.cxx +++ b/src/libserver/html/html.cxx @@ -574,21 +574,17 @@ html_is_absolute_url(std::string_view st) -> bool [](auto c) {return !g_ascii_isalnum(c);}); if (alnum_pos != std::end(st)) { - std::advance(alnum_pos, 1); + if (*alnum_pos == ':') { + if (st.substr(0, std::distance(std::begin(st), alnum_pos)) == "mailto") { + return true; + } - if (alnum_pos != std::end(st)) { - if (*alnum_pos == ':') { - if (st.substr(0, std::distance(std::begin(st), alnum_pos)) == "mailto") { + std::advance(alnum_pos, 1); + if (alnum_pos != std::end(st)) { + /* Include even malformed urls */ + if (*alnum_pos == '/' || *alnum_pos == '\\') { return true; } - - std::advance(alnum_pos, 1); - if (alnum_pos != std::end(st)) { - /* Include even malformed urls */ - if (*alnum_pos == '/' || *alnum_pos == '\\') { - return true; - } - } } } } -- 2.47.3