Skip to content

Commit a757fb0

Browse files
chinyeunglipombredanne
authored andcommitted
#310 Support spaces in filename
The spec does not state if spaces are supported. The previous code will throw the following critical error if space is detected in file name: ``` CRITICAL: Invalid characters ' ' in file name at: ``` This commit add ' ' as a valid character. Signed-off-by: Chin Yeung Li <[email protected]>
1 parent b9c8532 commit a757fb0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/attributecode/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def to_posix(path):
8383
UNC_PREFIX_POSIX = to_posix(UNC_PREFIX)
8484
UNC_PREFIXES = (UNC_PREFIX_POSIX, UNC_PREFIX,)
8585

86-
valid_file_chars = string.digits + string.ascii_letters + '_-.'
86+
valid_file_chars = string.digits + string.ascii_letters + '_-.' + ' '
8787

8888

8989
def invalid_chars(path):

tests/test_util.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ def test_invalid_chars_with_valid_chars(self):
171171
expected = []
172172
assert expected == result
173173

174+
def test_space_is_valid_chars(self):
175+
result = util.invalid_chars(' ')
176+
expected = []
177+
assert expected == result
178+
174179
def test_invalid_chars_with_invalid_in_name_and_dir(self):
175180
result = util.invalid_chars('_$as/afg:')
176181
expected = [':']

0 commit comments

Comments
 (0)