android's got hella strict filename rules

This commit is contained in:
ed 2023-08-15 06:46:57 +02:00
parent afcd98b794
commit 474d5a155b
3 changed files with 10 additions and 6 deletions

View file

@ -57,6 +57,7 @@ SSEELOG = " ({})".format(SEE_LOG)
BAD_CFG = "invalid config; {}".format(SEE_LOG) BAD_CFG = "invalid config; {}".format(SEE_LOG)
SBADCFG = " ({})".format(BAD_CFG) SBADCFG = " ({})".format(BAD_CFG)
class AXS(object): class AXS(object):
def __init__( def __init__(
self, self,

View file

@ -41,8 +41,8 @@ from .util import (
MultipartParser, MultipartParser,
Pebkac, Pebkac,
UnrecvEOF, UnrecvEOF,
alltrace,
absreal, absreal,
alltrace,
atomic_move, atomic_move,
exclude_dotfiles, exclude_dotfiles,
fsenc, fsenc,

View file

@ -1228,12 +1228,15 @@ def ren_open(
except OSError as ex_: except OSError as ex_:
ex = 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 asciified = True
bname, fname = [ zsl = []
zs.encode("ascii", "replace").decode("ascii").replace("?", "_") for zs in (bname, fname):
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 continue
# ENOTSUP: zfs on ubuntu 20.04 # ENOTSUP: zfs on ubuntu 20.04