Skip to content

Commit 9b7031b

Browse files
committed
preserve non-ASCII characters when removing special characters in file name
1 parent 6794501 commit 9b7031b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

edx_dl/edx_dl.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,9 @@ def _build_filename_from_url(url, target_dir, filename_prefix, is_video=False,
781781
original_filename = 'video_%05d.mp4' % video_counter[0]
782782
else:
783783
original_filename = url.rsplit('/', 1)[1]
784-
# escape characters like ':' that may cause problems under Windows
785-
original_filename = quote(original_filename)
784+
# remove special characters that may cause problems under Windows
785+
original_filename = ''.join(list(filter(
786+
lambda c: c not in ';/?:@&=+$,', original_filename)))
786787
filename = os.path.join(target_dir,
787788
filename_prefix + '-' + original_filename)
788789

0 commit comments

Comments
 (0)