提交 d88c1534 编写于 作者: W wuzewu

Fix download issue

上级 c416ab6d
......@@ -184,6 +184,11 @@ def download(name,
decompress=True,
resource_type='Model',
extra=None):
file = os.path.join(save_path, name)
file = os.path.realpath(file)
if os.path.exists(file):
return
if not hub.HubServer()._server_check():
raise ServerConnectionError
......@@ -194,12 +199,10 @@ def download(name,
raise ResourceNotFoundError(name, version)
url = search_result['url']
file = os.path.join(save_path, name)
file = os.path.realpath(file)
if os.path.exists(file):
return
with tmp_dir() as _dir:
if not os.path.exists(save_path):
os.makedirs(save_path)
_, _, savefile = default_downloader.download_file(
url=url, save_path=_dir, print_progress=True)
if tarfile.is_tarfile(savefile) and decompress:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册