From 461fe5b0d5359f5dabd999ff8bf9ed1dfbb85e8c Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Wed, 11 Aug 2021 17:24:55 -0600 Subject: [PATCH] check if dir exists and is not a link --- report-modules-plugins.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/report-modules-plugins.py b/report-modules-plugins.py index f3e913d8..afdd84dd 100644 --- a/report-modules-plugins.py +++ b/report-modules-plugins.py @@ -411,17 +411,19 @@ def handle_item(item, filectx): def os_walk(from_path): - for (dirpath, _, filenames) in os.walk(from_path): - for filename in filenames: - filepath = os.path.join(dirpath, filename) - yield filepath + if os.path.isdir(from_path) and not os.path.islink(from_path): + for (dirpath, _, filenames) in os.walk(from_path): + for filename in filenames: + filepath = os.path.join(dirpath, filename) + yield filepath def os_listdir(from_path): - for dirent in os.scandir(from_path): - if dirent.is_symlink(): - continue - yield dirent.name, dirent.path + if os.path.isdir(from_path) and not os.path.islink(from_path): + for dirent in os.scandir(from_path): + if dirent.is_symlink(): + continue + yield dirent.name, dirent.path def process_yml_file(filepath, ctx):