Skip to content

Commit 4d1a4c7

Browse files
committed
#378 - Add support for special character
- Add support for the following chars: "(", ")", "~", "[", "]", "{", "}" Signed-off-by: Chin Yeung Li <[email protected]>
1 parent 627f903 commit 4d1a4c7

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

SPECIFICATION.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ A file name can contain only these US-ASCII characters:
7272

7373
- digits from 0 to 9
7474
- uppercase and lowercase letters from A to Z
75-
- the "_" underscore, "-" dash, "+" plus and "." period signs.
75+
- the following symbols: "_", "-", "+", ".", "(", ")", "~", "[", "]", "{", "}"
7676

7777
- The case of a file name is not significant. On case-sensitive file systems
7878
(such as on Linux), a tool must report an error if two ABOUT files stored in

docs/CHANGELOG.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
2018-XX-XX
1+
2019-XX-XX
22

33
Release 3.4.0.pre1
44

5-
* Support filenames/path with spaces #310
5+
* Support filenames/path with special characters #310 #378 #392
66
* Update ABOUT file format to match the specification
7-
* Support filename/path with a "+" plus sign #392
87

98
2018-11-15
109

src/attributecode/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def to_posix(path):
6767
UNC_PREFIX_POSIX = to_posix(UNC_PREFIX)
6868
UNC_PREFIXES = (UNC_PREFIX_POSIX, UNC_PREFIX,)
6969

70-
valid_file_chars = string.digits + string.ascii_letters + '_-.+' + ' '
70+
valid_file_chars = string.digits + string.ascii_letters + '_-.+()~[]{}|' + ' '
7171

7272

7373
def invalid_chars(path):

tests/test_util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ def test_invalid_chars_with_invalid_in_name_and_dir(self):
149149
assert expected == result
150150

151151
def test_invalid_chars_in_file_name(self):
152-
name = '%657!1351()275612$_$asafg:'
152+
name = '%657!1351()275612$_$asafg:~|[]{}+-.'
153153
result = util.invalid_chars(name)
154-
expected = ['%', '!', '(', ')', '$', '$', ':']
154+
expected = ['%', '!', '$', '$', ':']
155155
assert expected == result
156156

157157
def test_invalid_chars_with_space_is_valid(self):

0 commit comments

Comments
 (0)