-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Labels
good first issueNew contributors, join in!New contributors, join in!service-badgeNew or updated service badgeNew or updated service badge
Description
Are you experiencing an issue with...
shields.io
🐞 Description
The martin crate, currently at v0.8.7, at one point published a v1.0.0-alpha version that was later yanked. The crates.io API returns versions in semver-DESC order, which means the yanked alpha version is accessed as the most recent one by this code (license access). As the result, instead of showing correct license info, it shows obsolete and non-refreshing data.
| const license = version ? version.license : versions[0].license |
Relevant portion of the API response for https://crates.io/api/v1/crates/martin
{
"versions": [
{
"created_at": "2021-10-18T13:32:02.600041+00:00",
"num": "1.0.0-alpha.0",
"license": "non-standard",
"updated_at": "2022-11-21T03:56:25.244956+00:00",
"yanked": true
},
{
"created_at": "2023-06-23T04:05:38.815265+00:00",
"num": "0.8.7",
"license": "MIT OR Apache-2.0",
"updated_at": "2023-06-23T04:05:38.815265+00:00",
"yanked": false
}
]
}🔗 Link to the badge
https://img.shields.io/crates/l/martin.svg
💡 Possible Solution
I believe it would be better to pick the first non-yanked version from the array instead, plus probably parse the version value and ignore all the pre-released too.
mkj
Metadata
Metadata
Assignees
Labels
good first issueNew contributors, join in!New contributors, join in!service-badgeNew or updated service badgeNew or updated service badge