dancephoria / gmail-backup-com

Automatically exported from code.google.com/p/gmail-backup-com
GNU General Public License v3.0
0 stars 0 forks source link

Backing up a mail with "\" (backslash) in subject line creates subfolders #17

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Backup a mail with "\" in the subject line.

What is the expected output? What do you see instead?

Expected: The file name of the backed up mail does not contain "\" and it is 
placed in the folder of all the other mails from the same month.

I see instead: The file name of the backed up mail contains "\", forcing the 
program to create subfolders with parts of the subject line as folder names.

What version of the product are you using? On what operating system?

Version: The latest available version, which is "revision 15 (2011-03-07)".

Operating system: Windows 7 64 bit.

Please provide any additional information below.

The bug is related to the DirectoryStorage.getMailFilename() method in gmb.py. 
This method calls the method _cleanFilename() which is meant to clean file 
names that *includes* folder paths, which is why it accepts "\" and "/" as 
valid characters. 

But the subject line of the email should be cleaned first to replace "\" and 
"/" with a safe replacement character.

The EmailStorage._templateDict() method actually attempts to do this, but only 
with "/", not with "\", in this line:

        ret = dict((k, v.replace('/', '_')) for (k, v) in ret.iteritems())

If this line is changed to:

        ret = dict((k, v.replace('/', '_').replace('\\', '_')) for (k, v) in ret.iteritems())

the problem should be solved.

Original issue reported on code.google.com by jesper.h...@gmail.com on 21 May 2013 at 11:39

GoogleCodeExporter commented 8 years ago
saloveju20@gmail.com

Original comment by 222sa...@gmail.com on 29 Sep 2013 at 5:09

GoogleCodeExporter commented 8 years ago
saloveju20@gmail.com

Original comment by 222sa...@gmail.com on 29 Sep 2013 at 5:32

GoogleCodeExporter commented 8 years ago
saloveju20@gmail.com

Original comment by salovej...@gmail.com on 29 Sep 2013 at 6:44