Blob Blame History Raw
From 8a2ca28f73d9e5f64dab0bdbdd445a2ea3caef30 Mon Sep 17 00:00:00 2001
From: Pat Lathem <pat.lathem@gwfathom.com>
Date: Sat, 15 Apr 2017 09:40:54 -0500
Subject: [PATCH] Make sure to only remove the first directory in the path. The
 previous code could affect the entire path and even filenames.

---
 lib/ansible/galaxy/role.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ansible/galaxy/role.py b/lib/ansible/galaxy/role.py
index 67bdc95..2a4783f 100644
--- a/lib/ansible/galaxy/role.py
+++ b/lib/ansible/galaxy/role.py
@@ -316,7 +316,7 @@ def install(self):
                             # bits that might be in the file for security purposes
                             # and drop any containing directory, as mentioned above
                             if member.isreg() or member.issym():
-                                parts = member.name.replace(archive_parent_dir, "").split(os.sep)
+                                parts = member.name.split(os.sep)[1:]
                                 final_parts = []
                                 for part in parts:
                                     if part != '..' and '~' not in part and '$' not in part: