Windows `check_file()` fix (#7938)

Resolves Ultralytics HUB CI errors.
This commit is contained in:
Glenn Jocher 2022-05-23 16:15:38 +02:00 committed by GitHub
parent 9b4e05439c
commit 541a5b72bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -419,7 +419,7 @@ def check_file(file, suffix=''):
if Path(file).is_file() or not file: # exists if Path(file).is_file() or not file: # exists
return file return file
elif file.startswith(('http:/', 'https:/')): # download elif file.startswith(('http:/', 'https:/')): # download
url = str(Path(file)).replace(':/', '://') # Pathlib turns :// -> :/ url = file # warning: Pathlib turns :// -> :/
file = Path(urllib.parse.unquote(file).split('?')[0]).name # '%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
if Path(file).is_file(): if Path(file).is_file():
LOGGER.info(f'Found {url} locally at {file}') # file already exists LOGGER.info(f'Found {url} locally at {file}') # file already exists