summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-02-20 08:40:38 (GMT)
committerGeorg Brandl <georg@python.org>2006-02-20 08:40:38 (GMT)
commit8f7c54eaa5e363ef02e99518253b3cb17f6602e6 (patch)
tree80de626902f35cd4d90f271c4641b020b256f4f6 /Lib/test
parent200a58058a504da4cc2f9145e671b009b0bedd27 (diff)
downloadcpython-8f7c54eaa5e363ef02e99518253b3cb17f6602e6.zip
cpython-8f7c54eaa5e363ef02e99518253b3cb17f6602e6.tar.gz
cpython-8f7c54eaa5e363ef02e99518253b3cb17f6602e6.tar.bz2
Bug #1413790: zipfile now sanitizes absolute archive names that are
not allowed by the specs.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_zipfile.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index 57e7423..9fadc30 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -45,6 +45,16 @@ class TestsWithSourceFile(unittest.TestCase):
for f in (TESTFN2, TemporaryFile(), StringIO()):
self.zipTest(f, zipfile.ZIP_DEFLATED)
+ def testAbsoluteArcnames(self):
+ zipfp = zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED)
+ zipfp.write(TESTFN, "/absolute")
+ zipfp.close()
+
+ zipfp = zipfile.ZipFile(TESTFN2, "r", zipfile.ZIP_STORED)
+ self.assertEqual(zipfp.namelist(), ["absolute"])
+ zipfp.close()
+
+
def tearDown(self):
os.remove(TESTFN)
os.remove(TESTFN2)