mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-25 16:06:43 +00:00
ansible-galaxy: fix searching with unicode
This commit is contained in:
committed by
Brian Coca
parent
06eabc9783
commit
096717edc5
2
changelogs/fragments/42866-galaxy-search-unicode.yaml
Normal file
2
changelogs/fragments/42866-galaxy-search-unicode.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- ansible-galaxy - Prevent unicode errors when searching - https://github.com/ansible/ansible/issues/42866
|
||||
@@ -30,7 +30,7 @@ from ansible.galaxy.token import GalaxyToken
|
||||
from ansible.module_utils.six import string_types
|
||||
from ansible.module_utils.six.moves.urllib.error import HTTPError
|
||||
from ansible.module_utils.six.moves.urllib.parse import quote as urlquote, urlencode
|
||||
from ansible.module_utils._text import to_native, to_text
|
||||
from ansible.module_utils._text import to_bytes, to_native, to_text
|
||||
from ansible.module_utils.urls import open_url
|
||||
|
||||
try:
|
||||
@@ -178,7 +178,7 @@ class GalaxyAPI(object):
|
||||
"""
|
||||
Find a role by name.
|
||||
"""
|
||||
role_name = urlquote(role_name)
|
||||
role_name = to_text(urlquote(to_bytes(role_name)))
|
||||
|
||||
try:
|
||||
parts = role_name.split(".")
|
||||
@@ -246,7 +246,7 @@ class GalaxyAPI(object):
|
||||
search_url = self.baseurl + '/search/roles/?'
|
||||
|
||||
if search:
|
||||
search_url += '&autocomplete=' + urlquote(search)
|
||||
search_url += '&autocomplete=' + to_text(urlquote(to_bytes(search)))
|
||||
|
||||
tags = kwargs.get('tags', None)
|
||||
platforms = kwargs.get('platforms', None)
|
||||
|
||||
Reference in New Issue
Block a user