Skip to content

Commit

Permalink
Fix getting directory member that doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
jhamrick committed Mar 7, 2015
1 parent bfa625e commit f5f8f4b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions library/release_assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,13 @@ def main():
tf = tarfile.open(src, 'r:gz')
prefix = os.path.commonprefix(tf.getnames()).rstrip("/")
if prefix != '':
member = tf.getmember(prefix)
if not member.isdir():
prefix = os.path.dirname(prefix)
try:
member = tf.getmember(prefix)
except KeyError:
pass
else:
if not member.isdir():
prefix = os.path.dirname(prefix)
tf.close()
if prefix == '':
module.fail_json(msg="Archive has no common prefix")
Expand Down

0 comments on commit f5f8f4b

Please sign in to comment.