1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -05:00

Changed regular expression for invalid characters in a file name

This commit is contained in:
cketti 2012-01-27 03:39:08 +01:00
parent 6c23e204ba
commit 1165787129

View File

@ -40,11 +40,19 @@ import com.fsck.k9.provider.AttachmentProvider;
public class AttachmentView extends FrameLayout {
/**
* Regular expression that represents characters that aren't allowed
* to be used in file names saved using K-9
* Regular expression that represents characters we won't allow in file names.
*
* <p>
* Allowed are:
* <ul>
* <li>word characters (letters, digits, and underscores): {@code \w}</li>
* <li>spaces: {@code " "}</li>
* <li>special characters: {@code !}, {@code #}, {@code $}, {@code %}, {@code &}, {@code '},
* {@code (}, {@code )}, {@code -}, {@code @}, {@code ^}, {@code `}, <code>&#123;</code>,
* <code>&#125;</code>, {@code ~}, {@code .}, {@code ,}</li>
* </ul></p>
*/
private static final String INVALID_CHARACTERS = "[^\\d\\s\\w!" +
"#\\$%&'\\(\\)\\-@\\^_`\\{\\}~.,]+";
private static final String INVALID_CHARACTERS = "[^\\w !#$%&'()\\-@\\^`{}~.,]+";
/**
* Invalid characters in a file name are replaced by this character.