diff options
author | Adam Thalhammer <[email protected]> | 2016-05-02 13:21:39 +1000 |
---|---|---|
committer | Adam Thalhammer <[email protected]> | 2016-05-02 13:21:39 +1000 |
commit | 79a2e94e79e65cdf4898bc2dedb6a1bb4ca9af3c (patch) | |
tree | 97cd368a2089b073d2f0c1638bc66bd75fe11443 /test | |
parent | 686cc8963441c37105c0447f31c5ea21405be05a (diff) | |
download | youtube-dl-79a2e94e79e65cdf4898bc2dedb6a1bb4ca9af3c.tar.gz youtube-dl-79a2e94e79e65cdf4898bc2dedb6a1bb4ca9af3c.zip |
Instead of replacing accented characters with an underscore when sanitizing file names in restricted mode, replace them with their non-accented equivalents fixes #9347
Diffstat (limited to 'test')
-rw-r--r-- | test/test_utils.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index e16a6761b..0072ba241 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -139,8 +139,8 @@ class TestUtil(unittest.TestCase): self.assertEqual('yes_no', sanitize_filename('yes? no', restricted=True)) self.assertEqual('this_-_that', sanitize_filename('this: that', restricted=True)) - tests = 'a\xe4b\u4e2d\u56fd\u7684c' - self.assertEqual(sanitize_filename(tests, restricted=True), 'a_b_c') + tests = 'aäb\u4e2d\u56fd\u7684c' + self.assertEqual(sanitize_filename(tests, restricted=True), 'aab_c') self.assertTrue(sanitize_filename('\xf6', restricted=True) != '') # No empty filename forbidden = '"\0\\/&!: \'\t\n()[]{}$;`^,#' @@ -155,6 +155,11 @@ class TestUtil(unittest.TestCase): self.assertTrue(sanitize_filename('-', restricted=True) != '') self.assertTrue(sanitize_filename(':', restricted=True) != '') + self.assertEqual(sanitize_filename( + 'ÂÃÄÀÁÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ', restricted=True), + 'AAAAAAAECEEEEIIIIDNOOOOOOUUUUYPssaaaaaaaeceeeeiiiionoooooouuuuypy') + pass + def test_sanitize_ids(self): self.assertEqual(sanitize_filename('_n_cd26wFpw', is_id=True), '_n_cd26wFpw') self.assertEqual(sanitize_filename('_BD_eEpuzXw', is_id=True), '_BD_eEpuzXw') |