diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 04f76219..b64515e2 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -381,7 +381,7 @@ def main(argv=None): nstrs = [] anymod = False - for ostr in al.v: + for ostr in al.v or []: mod = False oa = ostr.split(":") na = oa[:2] diff --git a/copyparty/bos/bos.py b/copyparty/bos/bos.py index dd260f68..a620094a 100644 --- a/copyparty/bos/bos.py +++ b/copyparty/bos/bos.py @@ -10,8 +10,8 @@ from . import path # printf 'os\.(%s)' "$(grep ^def bos/__init__.py | gsed -r 's/^def //;s/\(.*//' | tr '\n' '|' | gsed -r 's/.$//')" -def chmod(p, mode, follow_symlinks=True): - return os.chmod(fsenc(p), mode, follow_symlinks=follow_symlinks) +def chmod(p, mode): + return os.chmod(fsenc(p), mode) def listdir(p="."): @@ -22,8 +22,8 @@ def lstat(p): return os.lstat(fsenc(p)) -def makedirs(name, mode=0o755, exist_ok=None): - return os.makedirs(fsenc(name), mode=mode, exist_ok=exist_ok) +def makedirs(name, mode=0o755): + return os.makedirs(fsenc(name), mode=mode) def mkdir(p, mode=0o755): @@ -42,13 +42,13 @@ def rmdir(p): return os.rmdir(fsenc(p)) -def stat(p, follow_symlinks=True): - return os.stat(fsenc(p), follow_symlinks=follow_symlinks) +def stat(p): + return os.stat(fsenc(p)) def unlink(p): return os.unlink(fsenc(p)) -def utime(p, times=None, follow_symlinks=True): - return os.utime(fsenc(p), times, follow_symlinks=follow_symlinks) +def utime(p, times=None): + return os.utime(fsenc(p), times) diff --git a/copyparty/httpsrv.py b/copyparty/httpsrv.py index 7ebaa8ed..280b905e 100644 --- a/copyparty/httpsrv.py +++ b/copyparty/httpsrv.py @@ -308,7 +308,7 @@ class HttpSrv(object): try: with os.scandir(os.path.join(E.mod, "web")) as dh: for fh in dh: - inf = fh.stat(follow_symlinks=False) + inf = fh.stat() v = max(v, inf.st_mtime) except: pass diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 6006550b..16328a81 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -1283,9 +1283,7 @@ class Up2k(object): ptop = vn.realpath atop = vn.canonical(rem) adir, fn = os.path.split(atop) - - fun = bos.lstat if os.supports_follow_symlinks else bos.stat - st = fun(atop) + st = bos.lstat(atop) if stat.S_ISLNK(st.st_mode) or stat.S_ISREG(st.st_mode): g = [[os.path.dirname(vpath), adir, [[fn, 0]], [], []]] else: diff --git a/copyparty/util.py b/copyparty/util.py index 0969a77e..a75cb328 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -1034,11 +1034,11 @@ def sendfile_kern(lower, upper, f, s): def statdir(logger, scandir, lstat, top): - lstat = lstat and os.supports_follow_symlinks 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: