Bug 2781

Summary: Unsanitised Folder Creation
Product: Claws Mail (Windows) Reporter: Abhay S. Kushwaha <clawsmail>
Component: defaultAssignee: users
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 3.9.0   
Hardware: PC   
OS: Windows NT   

Description Abhay S. Kushwaha 2012-11-14 10:35:27 UTC
When creating a new folder (at least on Windows), the folder name typed in by the user should be sanitised, for example, trailing space removed, trailing periods removed, etc. so that illegal folder names are not attempted.

Currently such requests are processed but the actual folder name on Windows file system (which creates the folders using legal characters or at least attempts to do so) does not match the folder name captured in folderlist.xml (which uses the input in the folder creation dialog box in Claws-Mail) which leads to various problems.
Comment 1 Abhay S. Kushwaha 2012-11-14 10:38:39 UTC
Actually, upgrading this to "Critical" because this leads to loss of data in some instances.
Comment 2 Ricardo Mones 2012-11-14 10:49:06 UTC
Can you provide a step by step example of losing data by creating a new folder?
Comment 3 Abhay S. Kushwaha 2012-11-14 11:19:16 UTC
Well, for argument's sake, could the folder showing up in Claws-Mail while it doesn't really exist be considered data loss?

But the actual data loss happens if you try to move emails to these "pseudo" folders.
Comment 4 Ricardo Mones 2012-11-14 11:38:51 UTC
Same I thought, data loss is caused by a bug in move. But that's a different problem from incorrect naming when creating folder under win32, hence should be a separate critical bug report (and this one downgraded from critical to normal ;)
Comment 5 Abhay S. Kushwaha 2015-07-19 10:51:19 UTC
This is partially resolved in the upcoming new build. Trailing dots are caught.
Comment 6 Andrej Kacian 2016-04-22 11:05:43 UTC
Can you give an example of a folder name that currently doesn't work? Leading and trailing space in a name seems to work just fine for me, at least on Windows 7.
Comment 7 Abhay S. Kushwaha 2016-04-22 12:29:19 UTC
Try creating a new folder called "Test " there is a trailing space there.

<folderitem .... path="inbox\Test " name="Test " type="normal" />

Note that the path has the training space.

Windows however creates "Test" with no trailing space.

So you see "Test " in Claws, "Test" in Windows Explorer, but if you copy or move a message to this folder in Claws, the copy/move operation doesn't work because of the extra space expected by Claws.
Comment 8 users 2016-04-22 13:33:03 UTC
Changes related to this bug have been committed.
Please check latest Git and update the bug accordingly.
You can also get the patch from:
http://git.claws-mail.org/

++ ChangeLog	2016-04-22 13:33:02.963632666 +0200
http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=6539be481076c1e55ba8489fd39ef71c999ed556
Merge: d990ea0 61383c6
Author: Colin Leroy <colin@colino.net>
Date:   Fri Apr 22 13:33:02 2016 +0200

    Merge branch 'master' of file:///home/git/claws

http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=61383c66ea45ad4e17efce4c59441b35bae5ff25
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Fri Apr 22 13:31:41 2016 +0200

    Disallow folder names ending with a space on Windows.
    
    Closes bug #2781.