Merge pull request #48836 from dwoz/unicode_names_py2

Fix unicode directory listing on py2
This commit is contained in:
Nicole Thomas 2018-07-31 16:22:52 -04:00 committed by GitHub
commit 950c1014aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -406,5 +406,9 @@ def os_walk(top, *args, **kwargs):
This is a helper than ensures that all paths returned from os.walk are
unicode.
'''
for item in os.walk(salt.utils.stringutils.to_str(top), *args, **kwargs):
if six.PY2 and salt.utils.platform.is_windows():
top_query = top
else:
top_query = salt.utils.stringutils.to_str(top)
for item in os.walk(top_query, *args, **kwargs):
yield salt.utils.data.decode(item, preserve_tuples=True)