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 <glenn.jocher@ultralytics.com>
This commit is contained in:
1 parent
cd35a009ba
commit
76d301bd21
1 file changed
+1
-1
+1
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user