From e8f781ea179866a3be20ef17a75fddd2aec73199 Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Fri, 26 Oct 2001 17:44:23 +0000 Subject: process(), save_attachment(): Set the umask before creating the attachments.pck file, so it gets the right permission too. --- Mailman/Handlers/Scrubber.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Mailman/Handlers/Scrubber.py b/Mailman/Handlers/Scrubber.py index 521b38186..911bee7e0 100644 --- a/Mailman/Handlers/Scrubber.py +++ b/Mailman/Handlers/Scrubber.py @@ -80,7 +80,11 @@ def process(mlist, msg, msgdata=None): payload = part.get_payload() ctype = part.get_type() size = len(payload) - url = save_attachment(mlist, part) + omask = os.umask(002) + try: + url = save_attachment(mlist, part) + finally: + os.umask(omask) desc = part.get('content-description', _('not available')) part.set_payload(_("""\ A non-text attachment was scrubbed... @@ -152,11 +156,7 @@ def save_attachment(mlist, msg): # We don't know what it is, so assume it's just a shapeless # application/octet-stream ext = '.bin' - omask = os.umask(002) - try: - fp = open(os.path.join(dir, file + ext), 'w') - finally: - os.umask(omask) + fp = open(os.path.join(dir, file + ext), 'w') fp.write(decodedpayload) fp.close() # Now calculate the url -- cgit v1.3.1