fix ansible galaxy file mangling (#23703)
without this patch, ansible-galaxy will mangle files containing the archive parent directory name, eg 'owncloud/files/owncloud.cron' will become 'owncloud/files/.cron'. The previous code could affect the entire path and even filenames. If a file path has the top level dir name as a substring, galaxy replaces it with ''. In one example, the archive top level dir is 'go', so 'files/go-bin.sh' becomes 'files/-bin.sh'. Fixes #22572, #23694, #23623
This commit is contained in:
parent
d04a5246de
commit
79943b86a1
1 changed files with 1 additions and 1 deletions
|
@ -319,7 +319,7 @@ class GalaxyRole(object):
|
||||||
# bits that might be in the file for security purposes
|
# bits that might be in the file for security purposes
|
||||||
# and drop any containing directory, as mentioned above
|
# and drop any containing directory, as mentioned above
|
||||||
if member.isreg() or member.issym():
|
if member.isreg() or member.issym():
|
||||||
parts = member.name.replace(archive_parent_dir, "").split(os.sep)
|
parts = member.name.replace(archive_parent_dir, "", 1).split(os.sep)
|
||||||
final_parts = []
|
final_parts = []
|
||||||
for part in parts:
|
for part in parts:
|
||||||
if part != '..' and '~' not in part and '$' not in part:
|
if part != '..' and '~' not in part and '$' not in part:
|
||||||
|
|
Loading…
Reference in a new issue