From d220144a84b71d4d6a35d68b091a45780c5e5162 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gust=C3=A4bel?= Date: Fri, 20 Apr 2007 14:49:02 +0000 Subject: [PATCH] Fix directory names to have only one trailing slash. A regression from rev. 52525. --- Lib/tarfile.py | 2 +- Lib/test/test_tarfile.py | 7 +++++++ Misc/NEWS | 11 +++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 4c7dadbc6a..261d9fbc36 100644 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -1842,7 +1842,7 @@ class TarFile(object): tarinfo.type = DIRTYPE # Directory names should have a '/' at the end. - if tarinfo.isdir(): + if tarinfo.isdir() and not tarinfo.name.endswith("/"): tarinfo.name += "/" self.members.append(tarinfo) diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index 692d72a17c..b1cbcf69c3 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -191,6 +191,13 @@ class ReadTest(BaseTest): except: pass + def test_dirtype(self): + for tarinfo in self.tar: + if tarinfo.isdir(): + self.assert_(tarinfo.name.endswith("/")) + self.assert_(not tarinfo.name[:-1].endswith("/")) + + class ReadStreamTest(ReadTest): sep = "|" diff --git a/Misc/NEWS b/Misc/NEWS index 6475b767d5..58f87eac66 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -4,6 +4,17 @@ Python News (editors: check NEWS.help for information about editing NEWS using ReST.) +What's New in Python 2.5.2c1? +============================= + +*Release date: XX-XXX-XXXX* + +Library +------- + +- tarfile.py: Fix directory names to have only one trailing slash. + + What's New in Python 2.5.1? ============================= -- 2.50.1