type,
text_part);
text_part->orig = part_content;
- rspamd_url_text_extract (task->task_pool, task, text_part, FALSE);
g_ptr_array_add (task->text_parts, text_part);
}
else {
c = p + 1;
}
}
+
+ if (!IS_PART_HTML (text_part)) {
+ rspamd_url_text_extract (task->task_pool, task, text_part, FALSE);
+ }
}
struct mime_foreach_data {
{
const gchar *p;
- /* A url must be finished by tld, so it must be followed by space character */
p = pos + match->m_len;
- if (p == cb->end || g_ascii_isspace (*p) || *p == ',') {
+ if (p == cb->end) {
match->m_len = p - match->m_begin;
return TRUE;
}
{
struct rspamd_url_mimepart_cbdata mcbd;
- if (part->content == NULL || part->content->len == 0) {
+ if (part->stripped_content == NULL || part->stripped_content->len == 0) {
msg_warn_task ("got empty text part");
return;
}
mcbd.task = task;
mcbd.part = part;
- rspamd_url_find_multiple (task->task_pool, part->content->data,
- part->content->len, is_html,
+ rspamd_url_find_multiple (task->task_pool, part->stripped_content->data,
+ part->stripped_content->len, is_html,
rspamd_url_text_part_callback, &mcbd);
/* Handle offsets of this part */
test("Extract urls from text", function()
local pool = mpool.create()
local cases = {
- {"test.com text", {"test.com", nil}},
- {" test.com text", {"test.com", nil}},
+ {"test.com", {"test.com", nil}},
+ {" test.com", {"test.com", nil}},
{"<test.com> text", {"test.com", nil}},
{"test.com. text", {"test.com", nil}},
{"mailto:A.User@example.com text", {"example.com", "A.User"}},