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)
SBADCFG = " ({})".format(BAD_CFG)
class AXS(object):
def __init__(
self,

View file

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

View file

@ -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