From fa6e3d35422fe85b38e065cc2a0425d0072eddce Mon Sep 17 00:00:00 2001 From: Serghei Mihai Date: Mon, 22 Aug 2016 13:51:07 +0200 Subject: [PATCH] include filename only for attached inline images (#12872) --- corbo/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/corbo/models.py b/corbo/models.py index 4258021..8676b90 100644 --- a/corbo/models.py +++ b/corbo/models.py @@ -1,3 +1,4 @@ +import os from datetime import datetime import logging import urlparse @@ -85,8 +86,9 @@ class Broadcast(models.Model): storage = DefaultStorage() for img in html_tree.xpath('//img/@src'): img_path = img.lstrip(storage.base_url) - m.attach(filename=img, data=storage.open(img_path)) - m.attachments[img].is_inline = True + img_name = os.path.basename(img_path) + m.attach(filename=img_name, data=storage.open(img_path)) + m.attachments[img_name].is_inline = True for s in subscriptions: if not s.identifier: continue -- 2.9.3