From 506a49f52b9d87bdd9b796e5184a7657a6506c46 Mon Sep 17 00:00:00 2001 From: tonio Date: Wed, 30 Jun 2010 09:17:31 +0200 Subject: [PATCH] fix: ticket #75, we are now using an absolute path when saving images to filesystem. --- lib/email_listing.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/email_listing.py b/lib/email_listing.py index df070ba6f..06473cbe6 100644 --- a/lib/email_listing.py +++ b/lib/email_listing.py @@ -198,13 +198,15 @@ class Email(object): getattr(self, "viewmail_%s" % mode)(contents[mode], links=links) def __save_image(self, fname, part): + from django.conf import settings + if re.search("\.\.", fname): return None - path = "static/tmp/" + fname - fp = open(path, "wb") + path = "/static/tmp/" + fname + fp = open(settings.MAILNG_DIR + path, "wb") fp.write(part.get_payload(decode=True)) fp.close() - return "/" + path + return path def map_cid(self, url): import re