mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Fix encoding issues with file paths. (#50830)
* Fix encoding issues with file paths. Discovered while testing with ANSIBLE_CONFIG env var set to a path that contained unicode characters while LC_ALL=C. * Fix unit tests. * Fix another path encoding issue.
This commit is contained in:
@@ -77,12 +77,12 @@ class VarsModule(BaseVarsPlugin):
|
||||
try:
|
||||
found_files = []
|
||||
# load vars
|
||||
opath = os.path.realpath(os.path.join(self._basedir, subdir))
|
||||
b_opath = os.path.realpath(to_bytes(os.path.join(self._basedir, subdir)))
|
||||
opath = to_text(b_opath)
|
||||
key = '%s.%s' % (entity.name, opath)
|
||||
if cache and key in FOUND:
|
||||
found_files = FOUND[key]
|
||||
else:
|
||||
b_opath = to_bytes(opath)
|
||||
# no need to do much if path does not exist for basedir
|
||||
if os.path.exists(b_opath):
|
||||
if os.path.isdir(b_opath):
|
||||
|
||||
Reference in New Issue
Block a user