commit 12210cb: [Minor] Do not advance iterator
Vsevolod Stakhov
vsevolod at highsecure.ru
Mon Jul 26 18:00:04 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-07-26 18:58:22 +0100
URL: https://github.com/rspamd/rspamd/commit/12210cb99c1a508c822936ac7d8e7ddeea8590e3
[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 97a8640c5..1d8206bba 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;
- }
- }
}
}
}
More information about the Commits
mailing list