Browse Source

Remove exclamation mark in --restrict-filenames mode

rtmp_test
Philipp Hagemeister 12 years ago
parent
commit
dffe658bac
2 changed files with 3 additions and 3 deletions
  1. +1
    -1
      test/test_utils.py
  2. +2
    -2
      youtube_dl/utils.py

+ 1
- 1
test/test_utils.py View File

@ -56,7 +56,7 @@ class TestUtil(unittest.TestCase):
self.assertEqual(sanitize_filename(u'aäb中国的c', restricted=True), u'a_b_c') self.assertEqual(sanitize_filename(u'aäb中国的c', restricted=True), u'a_b_c')
self.assertTrue(sanitize_filename(u'ö', restricted=True) != u'') # No empty filename self.assertTrue(sanitize_filename(u'ö', restricted=True) != u'') # No empty filename
forbidden = u'"\0\\/&: \'\t\n'
forbidden = u'"\0\\/&!: \'\t\n'
for fc in forbidden: for fc in forbidden:
for fbc in forbidden: for fbc in forbidden:
self.assertTrue(fbc not in sanitize_filename(fc, restricted=True)) self.assertTrue(fbc not in sanitize_filename(fc, restricted=True))


+ 2
- 2
youtube_dl/utils.py View File

@ -208,7 +208,7 @@ def sanitize_filename(s, restricted=False):
return '_-' if restricted else ' -' return '_-' if restricted else ' -'
elif char in '\\/|*<>': elif char in '\\/|*<>':
return '_' return '_'
if restricted and (char in '&\'' or char.isspace()):
if restricted and (char in '!&\'' or char.isspace()):
return '_' return '_'
if restricted and ord(char) > 127: if restricted and ord(char) > 127:
return '_' return '_'
@ -316,7 +316,7 @@ class ContentTooShortError(Exception):
class Trouble(Exception): class Trouble(Exception):
"""Trouble helper exception """Trouble helper exception
This is an exception to be handled with This is an exception to be handled with
FileDownloader.trouble FileDownloader.trouble
""" """


Loading…
Cancel
Save