cdnjs / api-server

📡 API server for api.cdnjs.com - The #1 free and open source CDN built to make life easier for developers.
https://api.cdnjs.com
MIT License
89 stars 38 forks source link

/libraries returns wrong data for some libraries #56

Open MartinKolarik opened 3 years ago

MartinKolarik commented 3 years ago

Details

Description

The filename and latest (not sure if any other) fields return incorrect values via /libraries endpoint for some libraries, while correct data is returned via /libraries/:library endpoint.

Steps to reproduce

Data for a library "caf" as returned by https://api.cdnjs.com/libraries?fields=name,latest,version,filename:

{
    "name": "caf",
    "latest": "https://cdnjs.cloudflare.com/ajax/libs/caf/13.1.1/caf.js",
    "version": "13.1.1",
    "filename": "caf.js"
},

Data for the same library as returned by https://api.cdnjs.com/libraries/caf?fields=name,latest,version,filename:

{
    "name": "caf",
    "latest": "https://cdnjs.cloudflare.com/ajax/libs/caf/13.1.1/umd/caf.js",
    "version": "13.1.1",
    "filename": "umd/caf.js"
}

Expected behavior

/libraries should return the same data as /libraries/:library

Logs

N/A

MattIPv4 commented 3 years ago

Version logs for ref: https://github.com/cdnjs/logs/tree/prod/packages/c/caf/13.1.1

MattIPv4 commented 3 years ago

I just ran a manual re-update of the library to trigger a reindex in Algolia (which is what backs our libraries search endpoint, rather than our own metadata the backs the individual library routes), and it seems to have resolved this:

https://api.cdnjs.com/libraries?fields=name,latest,version,filename&search=caf

{"results":[{"name":"caf","latest":"https://cdnjs.cloudflare.com/ajax/libs/caf/13.1.1/umd/caf.js","version":"13.1.1","filename":"umd/caf.js"}],"total":1,"available":1}
MattIPv4 commented 3 years ago

@tc80 I wonder if, once we've done our latest set of maintenance to the bot, it'd be worth doing a reindex of the latest versions of every library in Algolia -- might resolve other libraries that have this issue, as well as the missing SRI & null version issues?

MartinKolarik commented 3 years ago

once we've done our latest set of maintenance to the bot, it'd be worth doing a reindex of the latest versions of every library in Algolia

That seems like a good idea as there are certainly more libraries with this problem right now.