# HG changeset patch # User Franz Glasner # Date 1740301269 -3600 # Node ID f3e0b479928c22723e58ab7de02a46f8c664b8c5 # Parent 44e62e36cad4acb7867bdef4aa04c7b573c67bda treesum: FIX: Also check for that backslashes are nor in u8name or u8path and encode them diff -r 44e62e36cad4 -r f3e0b479928c cutils/util/walk.py --- a/cutils/util/walk.py Sat Feb 22 18:27:10 2025 +0100 +++ b/cutils/util/walk.py Sun Feb 23 10:01:09 2025 +0100 @@ -196,7 +196,7 @@ n = self.uname if n is None: return None - if (u'\n' in n) or (u'\r' in n): + if (u'\n' in n) or (u'\r' in n) or (u'\\' in n): return None return n.encode("utf-8", "strict") @@ -210,7 +210,7 @@ p = self.upath if p is None: return None - if (u'\n' in p) or (u'\r' in p): + if (u'\n' in p) or (u'\r' in p) or (u'\\' in p): return None return p.encode("utf-8", "strict") @@ -235,10 +235,12 @@ s = (WalkDirEntry.surrogate_decode(what) .encode("ascii", "backslashreplace")) else: - s = what.encode("ascii", "backslashreplace") + s = what.encode("ascii", "backslashreplace") else: s = what.encode("utf-8", "backslashreplace") - return s.replace(b'\n', b"\\x0a").replace(b'\r', b"\\x0d") + return (s.replace(b'\\', b"\\x5c") + .replace(b'\n', b"\\x0a") + .replace(b'\r', b"\\x0d")) @property def is_symlink(self):