Skip to content

Commit

Permalink
Compat with servers containing packages with user no channel (#13590)
Browse files Browse the repository at this point in the history
* compat with servers containing packages with user no channel

* wip
  • Loading branch information
memsharded authored Apr 17, 2023
1 parent d690d31 commit 3090031
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions conans/client/rest/rest_client_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from conans.errors import (EXCEPTION_CODE_MAPPING, ConanException,
AuthenticationException, RecipeNotFoundException,
PackageNotFoundException)
from conans.model.ref import ConanFileReference
from conans.model.ref import ConanFileReference, get_reference_fields
from conans.util.files import decode_text
from conans.util.log import logger

Expand Down Expand Up @@ -242,12 +242,19 @@ def search(self, pattern=None, ignorecase=True):
"""
url = self.router.search(pattern, ignorecase)
response = self.get_json(url)["results"]
result = []
try:
return [ConanFileReference.loads(reference) for reference in response]
except TypeError as te:
for reference in response:
name, version, user, channel, revision = get_reference_fields(reference)
# In Conan 2.0 it is possible to have user and not channel, skip it
if user and not channel:
continue
result.append(ConanFileReference.loads(reference))
except TypeError:
raise ConanException("Unexpected response from server.\n"
"URL: `{}`\n"
"Expected an iterable, but got {}.".format(url, type(response)))
return result

def search_packages(self, ref):
"""Client is filtering by the query"""
Expand Down

0 comments on commit 3090031

Please sign in to comment.