Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compat with servers containing packages with user no channel #13590

Merged
merged 2 commits into from
Apr 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to have channel and not user?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no

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