From 8a6502aaa49478e56fe867917d7edc293efd3329 Mon Sep 17 00:00:00 2001 From: Andreas Moog Date: Sat, 3 Dec 2011 18:09:49 +0100 Subject: [PATCH] Use regex to filter unwanted characters in filename --- ubuntutools/requestsync/mail.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ubuntutools/requestsync/mail.py b/ubuntutools/requestsync/mail.py index 70801f3..a1684ce 100644 --- a/ubuntutools/requestsync/mail.py +++ b/ubuntutools/requestsync/mail.py @@ -21,6 +21,7 @@ # of the GNU General Public License license. import os +import re import sys import smtplib import socket @@ -163,7 +164,7 @@ Content-Type: text/plain; charset=UTF-8 confirmation_prompt() # save mail in temporary file - f=open("/tmp/requestsync-" + bugtitle.replace(" ","_"), "w") + f=open("/tmp/requestsync-" + re.sub("[^a-zA-Z0-9_\-]","",bugtitle.replace(" ","_")), "w") f.write(mail) f.close()