diff --git a/copyparty/util.py b/copyparty/util.py index a75cb328..38b31654 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -1034,11 +1034,13 @@ def sendfile_kern(lower, upper, f, s): def statdir(logger, scandir, lstat, top): + if lstat and not os.supports_follow_symlinks: + scandir = False + try: btop = fsenc(top) if scandir and hasattr(os, "scandir"): src = "scandir" - lstat = lstat and os.supports_follow_symlinks with os.scandir(btop) as dh: for fh in dh: try: