Skip to content

Commit

Permalink
Sanitize newfilename in renamer.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashish0804 committed Jan 3, 2022
1 parent 5009690 commit 33833bb
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions yt_dlp/postprocessor/renamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def run(self, info):
prefix = prefix.replace(' ', '.').replace('\'', '').replace(',', '')

newfile = re.sub(r'\.{2,}', '.', f'{dir_path}/{prefix}.{suffix}')
newfile = re.sub(r'\\|\/|\:|\*|\?|\"|\<|\>|\|', '_', newfile)
self.to_screen('Renaming file "%s" to "%s"' % (file, newfile))
shutil.move(file, newfile)
info['filepath'] = newfile
Expand Down

0 comments on commit 33833bb

Please sign in to comment.