ultralytics 8.0.33 security updates and fixes (#896)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Mert Can Demir <validatedev@gmail.com>
This commit is contained in:
Glenn Jocher 2023-02-10 01:37:57 +04:00 committed by GitHub
parent a5a3ce88b3
commit 254adfa652
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 87 additions and 61 deletions

View file

@ -6,7 +6,7 @@ from itertools import repeat
from multiprocessing.pool import ThreadPool
from pathlib import Path
from urllib import parse, request
from zipfile import ZipFile
from zipfile import ZipFile, is_zipfile, BadZipFile
import requests
import torch
@ -33,6 +33,8 @@ def unzip_file(file, path=None, exclude=('.DS_Store', '__MACOSX')):
Unzip a *.zip file to path/, excluding files containing strings in exclude list
Replaces: ZipFile(file).extractall(path=path)
"""
if not (Path(file).exists() and is_zipfile(file)):
raise BadZipFile(f"File '{file}' does not exist or is a bad zip file.")
if path is None:
path = Path(file).parent # default path
with ZipFile(file) as zipObj: