diff --git a/copyparty/authsrv.py b/copyparty/authsrv.py index a4d62c20..6673f235 100644 --- a/copyparty/authsrv.py +++ b/copyparty/authsrv.py @@ -57,6 +57,7 @@ SSEELOG = " ({})".format(SEE_LOG) BAD_CFG = "invalid config; {}".format(SEE_LOG) SBADCFG = " ({})".format(BAD_CFG) + class AXS(object): def __init__( self, diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index c123c391..85411dec 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -41,8 +41,8 @@ from .util import ( MultipartParser, Pebkac, UnrecvEOF, - alltrace, absreal, + alltrace, atomic_move, exclude_dotfiles, fsenc, diff --git a/copyparty/util.py b/copyparty/util.py index fab74b79..1221675a 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -1228,12 +1228,15 @@ def ren_open( except OSError as ex_: ex = ex_ - if ex.errno == errno.EINVAL and not asciified: + # EPERM: android13 + if ex.errno in (errno.EINVAL, errno.EPERM) and not asciified: asciified = True - bname, fname = [ - zs.encode("ascii", "replace").decode("ascii").replace("?", "_") - for zs in [bname, fname] - ] + zsl = [] + for zs in (bname, fname): + zs = zs.encode("ascii", "replace").decode("ascii") + zs = re.sub(r"[^][a-zA-Z0-9(){}.,+=!-]", "_", zs) + zsl.append(zs) + bname, fname = zsl continue # ENOTSUP: zfs on ubuntu 20.04