mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 09:19:31 +00:00
acls (posix platforms): use surrogatescape error handling for posix_acl_use_stored_uid_gid
surrogatescape will decode/encode invalid utf-8 sequences (if we do not get utf-8) in a round-tripping way.
This commit is contained in:
parent
b2cffe00fe
commit
63ed5d9949
1 changed files with 2 additions and 2 deletions
|
@ -516,14 +516,14 @@ def posix_acl_use_stored_uid_gid(acl):
|
|||
"""Replace the user/group field with the stored uid/gid
|
||||
"""
|
||||
entries = []
|
||||
for entry in acl.decode('ascii').split('\n'):
|
||||
for entry in acl.decode('utf-8', 'surrogateescape').split('\n'):
|
||||
if entry:
|
||||
fields = entry.split(':')
|
||||
if len(fields) == 4:
|
||||
entries.append(':'.join([fields[0], fields[3], fields[2]]))
|
||||
else:
|
||||
entries.append(entry)
|
||||
return ('\n'.join(entries)).encode('ascii')
|
||||
return '\n'.join(entries).encode('utf-8', 'surrogateescape')
|
||||
|
||||
|
||||
class Location:
|
||||
|
|
Loading…
Reference in a new issue