Remove exclamation mark in --restrict-filenames mode
authorPhilipp Hagemeister <phihag@phihag.de>
Tue, 27 Nov 2012 16:15:33 +0000 (17:15 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Tue, 27 Nov 2012 16:15:33 +0000 (17:15 +0100)
test/test_utils.py
youtube_dl/utils.py

index e7d4e03309ac3933f5da00057db21c65c46606f4..a3a23fbb4a5a71da86488c951b151c5c42e17456 100644 (file)
@@ -56,7 +56,7 @@ class TestUtil(unittest.TestCase):
                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
 
-               forbidden = u'"\0\\/&: \'\t\n'
+               forbidden = u'"\0\\/&!: \'\t\n'
                for fc in forbidden:
                        for fbc in forbidden:
                                self.assertTrue(fbc not in sanitize_filename(fc, restricted=True))
index 4ace22c2fc232ecacef491fd6ac6ecbd0ca3df01..a0c41081acb10b48c052b8c2d0eb79de8cc4eb0a 100644 (file)
@@ -208,7 +208,7 @@ def sanitize_filename(s, restricted=False):
                        return '_-' if restricted else ' -'
                elif char in '\\/|*<>':
                        return '_'
-               if restricted and (char in '&\'' or char.isspace()):
+               if restricted and (char in '!&\'' or char.isspace()):
                        return '_'
                if restricted and ord(char) > 127:
                        return '_'
@@ -316,7 +316,7 @@ class ContentTooShortError(Exception):
 
 class Trouble(Exception):
        """Trouble helper exception
-       
+
        This is an exception to be handled with
        FileDownloader.trouble
        """