mirror of https://github.com/CIRCL/PyCIRCLean
Fix handling of symlinks
parent
fabc2cf7c4
commit
36c4493cd6
|
@ -732,12 +732,13 @@ class KittenGroomerFileCheck(KittenGroomerBase):
|
||||||
queue = []
|
queue = []
|
||||||
for path in sorted(os.listdir(root_dir_path), key=lambda x: str.lower(x)):
|
for path in sorted(os.listdir(root_dir_path), key=lambda x: str.lower(x)):
|
||||||
full_path = os.path.join(root_dir_path, path)
|
full_path = os.path.join(root_dir_path, path)
|
||||||
if os.path.isdir(full_path):
|
# check for symlinks first to prevent getting trapped in infinite symlink recursion
|
||||||
|
if os.path.islink(full_path):
|
||||||
|
queue.append(full_path)
|
||||||
|
elif os.path.isdir(full_path):
|
||||||
queue.append(full_path)
|
queue.append(full_path)
|
||||||
queue += self.list_files_dirs(full_path)
|
queue += self.list_files_dirs(full_path)
|
||||||
elif os.path.isfile(full_path, follow_symlinks=False):
|
elif os.path.isfile(full_path):
|
||||||
queue.append(full_path)
|
|
||||||
elif os.path.islink(full_path):
|
|
||||||
queue.append(full_path)
|
queue.append(full_path)
|
||||||
return queue
|
return queue
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue