]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[utils] Fix sanitize_open
authorSergey M․ <dstftw@gmail.com>
Sun, 8 Mar 2015 14:56:28 +0000 (20:56 +0600)
committerSergey M․ <dstftw@gmail.com>
Sun, 8 Mar 2015 14:56:28 +0000 (20:56 +0600)
youtube_dl/utils.py

index 0f49d602eab1296dced15449a949c26dc4408d66..e511232caae2fd68fb13446df5da79cff9fff8a3 100644 (file)
@@ -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)