44from __future__ import print_function
55from __future__ import unicode_literals
66
7- import operator
87import os
98import tarfile
109import typing
1110from collections import OrderedDict
12- from typing import cast , IO
1311
1412import six
1513from six .moves import map
@@ -309,7 +307,7 @@ def _directory_entries(self):
309307
310308 # add all implicit dirnames if not in the cache already
311309 for partial_name in map (relpath , recursepath (_name )):
312- dirinfo = tarfile .TarInfo (self . _encode (partial_name ))
310+ dirinfo = tarfile .TarInfo (_encode (partial_name ))
313311 dirinfo .type = tarfile .DIRTYPE
314312 _cache .setdefault (partial_name , dirinfo )
315313
@@ -391,7 +389,6 @@ def getinfo(self, path, namespaces=None):
391389 raw_info ["details" ] = {"type" : int (ResourceType .directory )}
392390
393391 else :
394-
395392 _realpath = self ._resolve (_path )
396393 if _realpath is None :
397394 raise errors .ResourceNotFound (path )
@@ -406,10 +403,10 @@ def getinfo(self, path, namespaces=None):
406403
407404 if "link" in namespaces :
408405 if member .issym ():
409- target = join (
406+ target = normpath ( join (
410407 dirname (self ._decode (member .name )),
411408 self ._decode (member .linkname ),
412- )
409+ )) # type: Option[Text]
413410 else :
414411 target = None
415412 raw_info ["link" ] = {"target" : target }
0 commit comments