]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Propagate images size to html linked images
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 1 May 2019 12:20:00 +0000 (13:20 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 1 May 2019 12:20:00 +0000 (13:20 +0100)
src/libmime/images.c

index b9a54b1a0feea770dfe65791a42e2d7eec575303..787417ab33c41a2d612b013225056a772f3b8760 100644 (file)
 #include "message.h"
 #include "html.h"
 
+#define msg_debug_images(...)  rspamd_conditional_debug_fast (NULL, NULL, \
+        rspamd_images_log_id, "images", task->task_pool->tag.uid, \
+        G_STRFUNC, \
+        __VA_ARGS__)
+
+INIT_LOG_MODULE(images)
+
 #ifdef USABLE_GD
 #include "gd.h"
 #include "hash.h"
@@ -603,7 +610,7 @@ process_image (struct rspamd_task *task, struct rspamd_mime_part *part)
        img = rspamd_maybe_process_image (task->task_pool, &part->parsed_data);
 
        if (img != NULL) {
-               debug_task ("detected %s image of size %ud x %ud in message <%s>",
+               msg_debug_images ("detected %s image of size %ud x %ud in message <%s>",
                        rspamd_image_type_str (img->type),
                        img->width, img->height,
                        task->message_id);
@@ -657,8 +664,15 @@ process_image (struct rspamd_task *task, struct rspamd_mime_part *part)
                                                                        img->html_image = himg;
                                                                        himg->embedded_image = img;
 
-                                                                       debug_task ("found linked image by cid: <%s>",
+                                                                       msg_debug_images ("found linked image by cid: <%s>",
                                                                                        cid);
+
+                                                                       if (himg->height == 0) {
+                                                                               himg->height = img->height;
+                                                                       }
+                                                                       if (himg->width == 0) {
+                                                                               himg->width = img->width;
+                                                                       }
                                                                }
                                                        }
                                                }