Skip to content
This repository has been archived by the owner on Jun 21, 2021. It is now read-only.

Commit

Permalink
[aria2c] Fix whitespace being stripped off
Browse files Browse the repository at this point in the history
  • Loading branch information
pukkandan committed May 2, 2021
1 parent cc0ec3e commit eb55bad
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions yt_dlp/downloader/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,19 @@ def _make_cmd(self, tmpfilename, info_dict):
cmd += self._bool_option('--remote-time', 'updatetime', 'true', 'false', '=')
cmd += self._configuration_args()

# aria2c strips out spaces from the beginning/end of filenames and paths.
# We work around this issue by adding a "./" to the beginning of the
# filename and relative path, and adding a "/" at the end of the path.
# See: https://github.com/yt-dlp/yt-dlp/issues/276
# https://github.com/ytdl-org/youtube-dl/issues/20312
# https://github.com/aria2/aria2/issues/1373
dn = os.path.dirname(tmpfilename)
if dn:
cmd += ['--dir', dn]
if not os.path.isabs(dn):
dn = '.%s%s' % (os.path.sep, dn)
cmd += ['--dir', dn + os.path.sep]
if 'fragments' not in info_dict:
cmd += ['--out', os.path.basename(tmpfilename)]
cmd += ['--out', '.%s%s' % (os.path.sep, os.path.basename(tmpfilename))]
cmd += ['--auto-file-renaming=false']

if 'fragments' in info_dict:
Expand Down

0 comments on commit eb55bad

Please sign in to comment.