Skip to content

Commit 122e694

Browse files
committed
try to always return Unicode file paths
closes #67
1 parent 10648b8 commit 122e694

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

libarchive/entry.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,14 @@ def set_birthtime(self, timestamp_sec, timestamp_nsec=0):
193193

194194
@property
195195
def pathname(self):
196-
return (ffi.entry_pathname_w(self._entry_p) or
197-
ffi.entry_pathname(self._entry_p))
196+
path = ffi.entry_pathname_w(self._entry_p)
197+
if not path:
198+
path = ffi.entry_pathname(self._entry_p)
199+
try:
200+
path = path.decode()
201+
except UnicodeError:
202+
pass
203+
return path
198204

199205
@pathname.setter
200206
def pathname(self, value):

0 commit comments

Comments
 (0)