Fix wrong download urls with shared repos #462
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes #459 using the potential solution I mentioned there.
Quick Overview
Instead of fetching the first release artifact, check the amount of assets, and if there are more than 1, attempt to find one with the same name as the current download url. If there is only 1 asset, or no asset with the same filename could be found, then default to the first asset.
This would leave the current behavior for plugins that have their own repository, but for plugins that share a repository, would require the plugin dev to ensure the proper artifact names correspond to the correct plugin.
When it comes to getting the original filename, I decided to use a regex:
which I've tested against the current set of plugins, and made it fit the username/repo name requirements that I could find.
If you want me to move away from the regex, to something like this:
then lmk.
I also went ahead and fixed the urls in the
Search Unicode - IdentifyandSearch Unicode - Searchplugins so that another PR isn't needed to do that