Fix special filenames being abspathed.
This commit is contained in:
parent
77a101c76c
commit
269fea9cb7
1 changed files with 8 additions and 9 deletions
|
@ -64,6 +64,7 @@ def download_file(
|
||||||
if localname in [None, '']:
|
if localname in [None, '']:
|
||||||
localname = basename_from_url(url)
|
localname = basename_from_url(url)
|
||||||
|
|
||||||
|
if not is_special_file(localname):
|
||||||
localname = pathclass.Path(localname)
|
localname = pathclass.Path(localname)
|
||||||
if localname.is_dir:
|
if localname.is_dir:
|
||||||
localname = localname.with_child(basename_from_url(url))
|
localname = localname.with_child(basename_from_url(url))
|
||||||
|
@ -71,9 +72,6 @@ def download_file(
|
||||||
localname = localname.absolute_path
|
localname = localname.absolute_path
|
||||||
localname = sanitize_filename(localname)
|
localname = sanitize_filename(localname)
|
||||||
|
|
||||||
if not is_special_file(localname):
|
|
||||||
localname = os.path.abspath(localname)
|
|
||||||
|
|
||||||
log.debug('URL: %s', url)
|
log.debug('URL: %s', url)
|
||||||
log.debug('File: %s', localname)
|
log.debug('File: %s', localname)
|
||||||
|
|
||||||
|
@ -100,7 +98,8 @@ def download_plan(plan):
|
||||||
temp_localname = plan.download_into
|
temp_localname = plan.download_into
|
||||||
real_localname = plan.real_localname
|
real_localname = plan.real_localname
|
||||||
directory = os.path.split(temp_localname)[0]
|
directory = os.path.split(temp_localname)[0]
|
||||||
if directory != '':
|
|
||||||
|
if directory != '' and not is_special_file(temp_localname):
|
||||||
os.makedirs(directory, exist_ok=True)
|
os.makedirs(directory, exist_ok=True)
|
||||||
|
|
||||||
if not is_special_file(temp_localname):
|
if not is_special_file(temp_localname):
|
||||||
|
|
Loading…
Reference in a new issue