From 066eab6e1c3f1c65a7f6465c947037059ae95ef1 Mon Sep 17 00:00:00 2001 From: Kalen Michael Date: Wed, 29 Sep 2021 19:48:45 +0200 Subject: [PATCH] Fix URL parsing bug (#4998) * added callbacks * added back callback to main * added save_dir to callback output * merged in upstream * removed ghost code * fixed parsing error for google temp links Co-authored-by: Glenn Jocher --- utils/general.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/general.py b/utils/general.py index 28301f8573bb..f2afb480cc63 100755 --- a/utils/general.py +++ b/utils/general.py @@ -313,7 +313,7 @@ def check_file(file, suffix=''): return file elif file.startswith(('http:/', 'https:/')): # download url = str(Path(file)).replace(':/', '://') # Pathlib turns :// -> :/ - file = Path(urllib.parse.unquote(file)).name.split('?')[0] # '%2F' to '/', split https://url.com/file.txt?auth + file = Path(urllib.parse.unquote(file).split('?')[0]).name # '%2F' to '/', split https://url.com/file.txt?auth print(f'Downloading {url} to {file}...') torch.hub.download_url_to_file(url, file) assert Path(file).exists() and Path(file).stat().st_size > 0, f'File download failed: {url}' # check