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

Fix cocoapods version enumeration #439

Merged
merged 1 commit into from
Jul 8, 2023
Merged

Conversation

gfs
Copy link
Contributor

@gfs gfs commented Jul 7, 2023

Fix #437

@@ -158,17 +160,22 @@ public override async Task<IEnumerable<string>> EnumerateVersionsAsync(PackageUR
string? html = await GetHttpStringCache(httpClient, $"{ENV_COCOAPODS_SPECS_ENDPOINT}/Specs/{prefix}/{packageName}");
HtmlParser parser = new();
AngleSharp.Html.Dom.IHtmlDocument document = await parser.ParseDocumentAsync(html);
AngleSharp.Dom.IHtmlCollection<AngleSharp.Dom.IElement> navItems = document.QuerySelectorAll("div.Details a.js-navigation-open");
// Fetch the embedded react data
string innerHtml = document.QuerySelector("script[data-target='react-app.embeddedData']").InnerHtml;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: We might run into the same issue if the html is changed again. Did we consider other options here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we do want to switch to a more permanent solution in the future - I'd recommend a switch to libgit2sharp, we can list the directories in the appropriate location in the specs repository.

This is just a bandaid fix to get it working again until we have time to do a better fix.

Copy link
Member

Choose a reason for hiding this comment

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

Are you sure you can do that remotely? I thought you'd need to clone the entire repo in order to enumerate files. You could use Octocat or another GitHub library but then you'd need the user to supply an access token.

Copy link
Contributor Author

@gfs gfs Jul 7, 2023

Choose a reason for hiding this comment

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

Fair point - I'm not positive you can do that remotely. I've only used libgit2sharp to clone/checkout and then perform operations in the past, but thats not optimal here. If we do have to switch to octocat and have a token it adds another layer of complexity as well.

@gfs gfs merged commit d84cb42 into main Jul 8, 2023
@gfs gfs deleted the gfs/FixCocoaPodsVersionEnumeration branch July 8, 2023 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to fetch versions for a Cocoapods package
3 participants