diff options
| author | bwarsaw | 2001-10-26 17:44:23 +0000 |
|---|---|---|
| committer | bwarsaw | 2001-10-26 17:44:23 +0000 |
| commit | e8f781ea179866a3be20ef17a75fddd2aec73199 (patch) | |
| tree | ee70579987428b61d42280d3a26f9520ad8fc874 | |
| parent | e482299136b255605a01ad5056daf5e3b9816ec7 (diff) | |
| download | mailman-e8f781ea179866a3be20ef17a75fddd2aec73199.tar.gz mailman-e8f781ea179866a3be20ef17a75fddd2aec73199.tar.zst mailman-e8f781ea179866a3be20ef17a75fddd2aec73199.zip | |
process(), save_attachment(): Set the umask before creating the
attachments.pck file, so it gets the right permission too.
| -rw-r--r-- | Mailman/Handlers/Scrubber.py | 12 |
1 files 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 |
