Skip to content

Commit

Permalink
Avoid duplicate paths when path injection
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Sep 18, 2024
1 parent d07db24 commit 36fb923
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ansible_compat/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,8 @@ def _update_env(self, varname: str, value: list[str], default: str = "") -> None
return
orig_value = self.environ.get(varname, default)
if orig_value:
value = [*value, *orig_value.split(":")]
# we just want to avoid repeating the same entries, but order is important
value = list(dict.fromkeys([*value, *orig_value.split(":")]))
value_str = ":".join(value)
if value_str != self.environ.get(varname, ""):
self.environ[varname] = value_str
Expand Down

0 comments on commit 36fb923

Please sign in to comment.