summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-03-08 20:56:28 +0600
committerSergey M․ <dstftw@gmail.com>2015-03-08 20:56:28 +0600
commitd55de57b67bceca5d9116ddcc2ada2fa1957d89d (patch)
tree0ff56d5c3fc7e1e1594c72c88ba1061dd5c4e37e
parenta2aaf4dbc6e5f5d345329b5a845111851453b6a6 (diff)
downloadyoutube-dl-d55de57b67bceca5d9116ddcc2ada2fa1957d89d.tar.gz
youtube-dl-d55de57b67bceca5d9116ddcc2ada2fa1957d89d.tar.xz
youtube-dl-d55de57b67bceca5d9116ddcc2ada2fa1957d89d.zip
[utils] Fix sanitize_open
-rw-r--r--youtube_dl/utils.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 0f49d602e..e511232ca 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -252,15 +252,12 @@ def sanitize_open(filename, open_mode):
             raise
 
         # In case of error, try to remove win32 forbidden chars
-        alt_filename = os.path.join(
-            re.sub('[/<>:"\\|\\\\?\\*]', '#', path_part)
-            for path_part in os.path.split(filename)
-        )
+        alt_filename = sanitize_path(filename)
         if alt_filename == filename:
             raise
         else:
             # An exception here should be caught in the caller
-            stream = open(encodeFilename(filename), open_mode)
+            stream = open(encodeFilename(alt_filename), open_mode)
             return (stream, alt_filename)