From dffe658bac71531dc6aa72088c4d98f6a556bfbf Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Tue, 27 Nov 2012 17:15:33 +0100 Subject: [PATCH] Remove exclamation mark in --restrict-filenames mode --- test/test_utils.py | 2 +- youtube_dl/utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_utils.py b/test/test_utils.py index e7d4e0330..a3a23fbb4 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -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)) diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 4ace22c2f..a0c41081a 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -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 """