From 14915d9c713246b0f284e8e2acec3f45587ef70e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D8=A3=D8=AD=D9=85=D8=AF=20=D8=A7=D9=84=D9=85=D8=AD=D9=85?= =?UTF-8?q?=D9=88=D8=AF=D9=8A?= Date: Wed, 29 Jul 2009 15:19:06 +0200 Subject: make tar_toplevel safer --- gbp/deb_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gbp') diff --git a/gbp/deb_utils.py b/gbp/deb_utils.py index d701eb4f..2af2fdf9 100644 --- a/gbp/deb_utils.py +++ b/gbp/deb_utils.py @@ -214,7 +214,9 @@ def repack_orig(archive, tmpdir, dest): def tar_toplevel(dir): """tar archives can contain a leading directory not""" unpacked = glob.glob('%s/*' % dir) - if len(unpacked) == 1: + unpacked.extend(glob.glob("%s/.*" % dir)) # include hidden files and folders + # Check that dir contains nothing but a single folder: + if len(unpacked) == 1 and os.path.isdir(unpacked[0]): return unpacked[0] else: return dir -- cgit v1.2.3