Skip to content

Commit

Permalink
preserve non-ASCII characters when removing special characters in fil…
Browse files Browse the repository at this point in the history
…e name
  • Loading branch information
yiwenlu66 committed Feb 16, 2019
1 parent 6794501 commit 9b7031b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions edx_dl/edx_dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,8 +781,9 @@ def _build_filename_from_url(url, target_dir, filename_prefix, is_video=False,
original_filename = 'video_%05d.mp4' % video_counter[0]
else:
original_filename = url.rsplit('/', 1)[1]
# escape characters like ':' that may cause problems under Windows
original_filename = quote(original_filename)
# remove special characters that may cause problems under Windows
original_filename = ''.join(list(filter(
lambda c: c not in ';/?:@&=+$,', original_filename)))
filename = os.path.join(target_dir,
filename_prefix + '-' + original_filename)

Expand Down

0 comments on commit 9b7031b

Please sign in to comment.