From abccaf3727fd5425faa59d2cb5ffd9e9d945f376 Mon Sep 17 00:00:00 2001 From: Robin David Date: Mon, 13 Jan 2025 00:36:35 +0100 Subject: [PATCH] fix quokka-cli, following symlinks can cause infinite loop --- bindings/python/quokka/__main__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/python/quokka/__main__.py b/bindings/python/quokka/__main__.py index 25d2774..b1307b2 100644 --- a/bindings/python/quokka/__main__.py +++ b/bindings/python/quokka/__main__.py @@ -37,7 +37,7 @@ class Bcolors: def recursive_file_iter(p: Path) -> Generator[Path, None, None]: - if p.is_file(): + if p.is_file() and not p.is_symlink(): mime_type = magic.from_file(p, mime=True) if mime_type not in BINARY_FORMAT and p.suffix not in EXTENSIONS_WHITELIST.get( mime_type, [] @@ -45,7 +45,7 @@ def recursive_file_iter(p: Path) -> Generator[Path, None, None]: pass else: yield p - elif p.is_dir(): + elif p.is_dir() and not p.is_symlink(): for f in p.iterdir(): yield from recursive_file_iter(f)