From f75482f1fe29f059af37f39ecb831c605654b86d Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Fri, 18 Mar 2016 15:31:18 +0100 Subject: [PATCH] Test whether files/paths exist before iterating in xglob (otherwise, no error is thrown for invalid paths) --- oletools/thirdparty/xglob/xglob.py | 2 ++ 1 file changed, 2 insertions(+), 0 deletions(-) diff --git a/oletools/thirdparty/xglob/xglob.py b/oletools/thirdparty/xglob/xglob.py index 48026a4..c02d0d9 100644 --- a/oletools/thirdparty/xglob/xglob.py +++ b/oletools/thirdparty/xglob/xglob.py @@ -131,6 +131,8 @@ def iter_files(files, recursive=False, zip_password=None, zip_fname='*'): else: iglob = glob.iglob for filespec in files: + if not os.path.exists(filespec): + raise ValueError('given path {} does not exist!'.format(filespec)) for filename in iglob(filespec): if zip_password is not None: # Each file is expected to be a zip archive: -- libgit2 0.21.4