mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
ansible-galaxy: fix searching with unicode
This commit is contained in:
parent
06eabc9783
commit
096717edc5
2 changed files with 5 additions and 3 deletions
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)
|
||||
|
|
Loading…
Reference in a new issue