Skip to content

Commit

Permalink
Fix unwanted sanitization of dirs in renamer.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashish0804 committed Jan 3, 2022
1 parent 33833bb commit a37acf4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions yt_dlp/postprocessor/renamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ def run(self, info):
else:
prefix = f'{info["title"]}.{info["upload_date"][0:4]}'
prefix = prefix.replace(' ', '.').replace('\'', '').replace(',', '')

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

0 comments on commit a37acf4

Please sign in to comment.