mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
bpo-21987: Fix TarFile.getmember getting a dir with a trailing slash (GH-30283)
This commit is contained in:
parent
22f73bd9f1
commit
cfadcc31ea
3 changed files with 22 additions and 1 deletions
|
|
@ -1789,7 +1789,7 @@ class TarFile(object):
|
|||
than once in the archive, its last occurrence is assumed to be the
|
||||
most up-to-date version.
|
||||
"""
|
||||
tarinfo = self._getmember(name)
|
||||
tarinfo = self._getmember(name.rstrip('/'))
|
||||
if tarinfo is None:
|
||||
raise KeyError("filename %r not found" % name)
|
||||
return tarinfo
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue