}
}
- auto url = html_process_url(pool, href_value);
+ auto url = html_process_url(pool, href_value).value_or(nullptr);
- if (url && std::holds_alternative<std::monostate>(tag->extra)) {
- tag->extra = url.value();
+ if (url) {
+ if (tag->id != Tag_A) {
+ /* Mark special tags special */
+ url->flags |= RSPAMD_URL_FLAG_SPECIAL;
+ }
+
+ if (std::holds_alternative<std::monostate>(tag->extra)) {
+ tag->extra = url;
+ }
}
return url;
}
hc->images.push_back(img);
- tag->extra = img;
+
+ if (std::holds_alternative<std::monostate>(tag->extra)) {
+ tag->extra = img;
+ }
}
static auto
* HTML part, we assume that it is also
* hint only.
*/
- if (turl->flags &
- RSPAMD_URL_FLAG_FROM_TEXT) {
- turl->flags |= displayed_url->flags;
+ if (turl->flags & RSPAMD_URL_FLAG_FROM_TEXT) {
+
+ /*
+ * We have the same URL for href and displayed url, so we
+ * know that this url cannot be both target and display (as
+ * it breaks logic in many places), so we do not
+ * propagate html flags
+ */
+ if (!(turl->flags & RSPAMD_URL_FLAG_DISPLAY_URL)) {
+ turl->flags |= displayed_url->flags;
+ }
turl->flags &= ~RSPAMD_URL_FLAG_FROM_TEXT;
}