From 739a8141a331a437b9bb91e96052ddb171fbe12f Mon Sep 17 00:00:00 2001 From: memsharded Date: Sun, 2 Apr 2023 00:07:33 +0200 Subject: [PATCH 1/2] compat with servers containing packages with user no channel --- conans/client/rest/rest_client_common.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/conans/client/rest/rest_client_common.py b/conans/client/rest/rest_client_common.py index c0fdb12377f..54116938891 100644 --- a/conans/client/rest/rest_client_common.py +++ b/conans/client/rest/rest_client_common.py @@ -5,8 +5,8 @@ from conans.client.rest import response_to_str from conans.errors import (EXCEPTION_CODE_MAPPING, ConanException, AuthenticationException, RecipeNotFoundException, - PackageNotFoundException) -from conans.model.ref import ConanFileReference + PackageNotFoundException, InvalidNameException) +from conans.model.ref import ConanFileReference, get_reference_fields from conans.util.files import decode_text from conans.util.log import logger @@ -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""" From e9f2cfa01ada6cb59ed84954ba645c35be2b87d7 Mon Sep 17 00:00:00 2001 From: memsharded Date: Sun, 2 Apr 2023 00:09:19 +0200 Subject: [PATCH 2/2] wip --- conans/client/rest/rest_client_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conans/client/rest/rest_client_common.py b/conans/client/rest/rest_client_common.py index 54116938891..da472a50940 100644 --- a/conans/client/rest/rest_client_common.py +++ b/conans/client/rest/rest_client_common.py @@ -5,7 +5,7 @@ from conans.client.rest import response_to_str from conans.errors import (EXCEPTION_CODE_MAPPING, ConanException, AuthenticationException, RecipeNotFoundException, - PackageNotFoundException, InvalidNameException) + PackageNotFoundException) from conans.model.ref import ConanFileReference, get_reference_fields from conans.util.files import decode_text from conans.util.log import logger