Skip to content

Commit

Permalink
fix error when the file name contains special characters in windows
Browse files Browse the repository at this point in the history
  • Loading branch information
csyezheng committed Oct 31, 2023
1 parent 98c9900 commit 77fbd6f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion edx_helper/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.6.2'
__version__ = '0.6.3'
12 changes: 9 additions & 3 deletions edx_helper/edx_dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,14 @@ def extract_units_from_vertical_block(vertical_block, headers, file_formats):
"""
Parses a webpage and extracts its resources e.g. video_url, sub_url, etc.
"""
vertical_block_api = COURSE_XBLOCK_API + '/' + vertical_block.block_id + '?show_title=0&show_bookmark_button=0' \
'&recheck_access=1&view=student_view'
params = {
'exam_access': '',
'show_title': 1,
'show_bookmark': 0,
'recheck_access': 1,
'view': 'student_view'
}
vertical_block_api = COURSE_XBLOCK_API + '/' + vertical_block.block_id + '?%s' % urlencode(params)
logging.debug("Extracting units from: \n'%s'", vertical_block_api)

page_title = vertical_block.name
Expand Down Expand Up @@ -928,7 +934,7 @@ def download_unit(unit, args, target_dir, filename_prefix, headers):
filename_prefix)
skip_or_download(res_downloads, headers, args)
if isinstance(unit, WebpageUnit):
file_name = filename_prefix + '-' + unit.page_title + '.html'
file_name = filename_prefix + '-' + clean_filename(unit.page_title) + '.html'
file_path = os.path.join(target_dir, file_name)
skip_or_save(file_path, unit.content)

Expand Down

0 comments on commit 77fbd6f

Please sign in to comment.