utarfile: Update for str.rstrip() fixes.

rstrip() without args no longer strips "\0", we need to do that explicitly.
pull/211/head
Paul Sokolovsky 2017-09-29 18:15:14 -07:00
rodzic 2f5f428f7c
commit a015fca3fa
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -3,7 +3,7 @@ import uctypes
# http://www.gnu.org/software/tar/manual/html_node/Standard.html
TAR_HEADER = {
"name": (uctypes.ARRAY | 0, uctypes.UINT8 | 100),
"size": (uctypes.ARRAY | 124, uctypes.UINT8 | 12),
"size": (uctypes.ARRAY | 124, uctypes.UINT8 | 11),
}
DIRTYPE = "dir"
@ -75,8 +75,8 @@ class TarFile:
return None
d = TarInfo()
d.name = str(h.name, "utf-8").rstrip()
d.size = int(bytes(h.size).rstrip(), 8)
d.name = str(h.name, "utf-8").rstrip("\0")
d.size = int(bytes(h.size), 8)
d.type = [REGTYPE, DIRTYPE][d.name[-1] == "/"]
self.subf = d.subf = FileSection(self.f, d.size, roundup(d.size, 512))
return d