# HG changeset patch # User Franz Glasner # Date 1744441548 -7200 # Node ID 29a301ff250107d649dae101212879fdf026acf8 # Parent a766264ff5bb971b8bf8559c091e829189b68863 treesum: FIX: also check for TABs when trying to encode strictly diff -r a766264ff5bb -r 29a301ff2501 cutils/util/walk.py --- a/cutils/util/walk.py Fri Apr 11 17:36:14 2025 +0200 +++ b/cutils/util/walk.py Sat Apr 12 09:05:48 2025 +0200 @@ -153,7 +153,7 @@ def fsname(self): """The name as bytes for the filesystem. - Also do not allow CR of LF in the name. + Also do not allow TAB, CR or LF in the name. :rtype: bytes or None @@ -167,7 +167,7 @@ return None else: s = os.fsencode(self._name) - if (b'\n' in s) or (b'\r' in s) or (b'\\' in s): + if (b'\n' in s) or (b'\r' in s) or (b'\t' in s) or (b'\\' in s): return None return s @@ -175,7 +175,7 @@ def fspath(self): """Always bytes. - Also do not allow CR of LF in the path. + Also do not allow TAB, CR or LF in the path. :rtype: bytes or None @@ -189,7 +189,7 @@ return None else: p = os.fsencode(self._path) - if (b'\n' in p) or (b'\r' in p) or (b'\\' in p): + if (b'\n' in p) or (b'\r' in p) or (b'\t' in p) or (b'\\' in p): return None return p @@ -288,13 +288,13 @@ def u8name(self): """`.uname` as UTF-8 or `None` (as strict as `uname`). - Also do not allow CR of LF in the name. + Also do not allow TAB, CR or LF in the name. """ n = self.uname if n is None: return None - if (u'\n' in n) or (u'\r' in n) or (u'\\' in n): + if (u'\n' in n) or (u'\r' in n) or (u'\t' in n) or (u'\\' in n): return None return n.encode("utf-8", "strict") @@ -302,13 +302,13 @@ def u8path(self): """`.upath` as UTF-8 or `None` (as strict as `upath`. - Also do not allow CR or LF in the path. + Also do not allow TAB, CR or LF in the path. """ p = self.upath if p is None: return None - if (u'\n' in p) or (u'\r' in p) or (u'\\' in p): + if (u'\n' in p) or (u'\r' in p) or (u'\t' in p) or (u'\\' in p): return None return p.encode("utf-8", "strict")