decode path and url to utf-8 in url.create

Related to #28524.
This commit is contained in:
Justin Findlay 2015-11-03 14:00:10 -07:00
parent c6a6fe0089
commit b05dfc5c58

View file

@ -11,6 +11,7 @@ import sys
# Import salt libs
from salt.ext.six.moves.urllib.parse import urlparse, urlunparse # pylint: disable=import-error,no-name-in-module
import salt.utils
from salt.utils.locales import sdecode
def parse(url):
@ -47,9 +48,10 @@ def create(path, saltenv=None):
'''
if salt.utils.is_windows():
path = salt.utils.sanitize_win_path_string(path)
path = sdecode(path)
query = u'saltenv={0}'.format(saltenv) if saltenv else ''
url = urlunparse(('file', '', path, '', query, ''))
url = sdecode(urlunparse(('file', '', path, '', query, '')))
return u'salt://{0}'.format(url[len('file:///'):])