aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorأحمد المحمودي <aelmahmoudy@users.sourceforge.net>2009-07-29 15:19:06 +0200
committerGuido Günther <agx@sigxcpu.org>2009-07-29 15:19:06 +0200
commit14915d9c713246b0f284e8e2acec3f45587ef70e (patch)
tree171be1d890571f4051b11f77b0e37356649529b7
parent8ea47477233c2f810c7310118f0a717e16ab940e (diff)
make tar_toplevel safer
-rw-r--r--gbp/deb_utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/gbp/deb_utils.py b/gbp/deb_utils.py
index d701eb4..2af2fdf 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