img->flags |=
(RSPAMD_HTML_FLAG_IMAGE_EMBEDDED|RSPAMD_HTML_FLAG_IMAGE_DATA);
rspamd_html_process_data_image (pool, img, comp);
+ hc->flags |= RSPAMD_HTML_FLAG_HAS_DATA_URLS;
}
else {
img->flags |= RSPAMD_HTML_FLAG_IMAGE_EXTERNAL;
* - `unknown_element`
* - `duplicate_element`
* - `unbalanced`
+ * - `data_urls`
*/
if (strcmp (propname, "no_html") == 0) {
ret = hc->flags & RSPAMD_HTML_FLAG_BAD_START;
else if (strcmp (propname, "unbalanced") == 0) {
ret = hc->flags & RSPAMD_HTML_FLAG_UNBALANCED;
}
+ else if (strcmp (propname, "unbalanced") == 0) {
+ ret = hc->flags & RSPAMD_HTML_FLAG_UNBALANCED;
+ }
+ else if (strcmp (propname, "data_urls") == 0) {
+ ret = hc->flags & RSPAMD_HTML_FLAG_HAS_DATA_URLS;
+ }
}
lua_pushboolean (L, ret);
if (img->src) {
lua_pushstring (L, "src");
- lua_pushstring (L, img->src);
+
+ if (img->flags & RSPAMD_HTML_FLAG_IMAGE_DATA) {
+ struct rspamd_lua_text *t;
+
+ t = lua_newuserdata (L, sizeof (*t));
+ t->start = img->src;
+ t->len = strlen (img->src);
+ t->flags = 0;
+
+ rspamd_lua_setclass (L, "rspamd{text}", -1);
+ }
+ else {
+ lua_pushstring (L, img->src);
+ }
+
lua_settable (L, -3);
}
lua_settable (L, -3);
lua_pushstring (L, "embedded");
lua_pushboolean (L, img->flags & RSPAMD_HTML_FLAG_IMAGE_EMBEDDED);
+ lua_pushstring (L, "data");
+ lua_pushboolean (L, img->flags & RSPAMD_HTML_FLAG_IMAGE_DATA);
lua_settable (L, -3);
}