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

Validate SRI files #26

Closed MattIPv4 closed 4 years ago

MattIPv4 commented 4 years ago

Type of Change

What issue does this relate to?

N/A

What should this PR do?

As discussed on Slack, we currently have no easy way of knowing if SRI data is missing for files. This adds logic to our SRI loading, so that if SRI data is missing for js/css files when a request comes in for a library or a version of a libary, we will log an error in Sentry & console.

This doesn't make the request fail, the existing clean error handling will allow SRI to be blank etc, but it does mean we will see Sentry errors for any missing SRI data.

What are the acceptance criteria?

CI passes, logic looks correct.

MattIPv4 commented 4 years ago

CI is currently failing due to an unrelated error -- the generated package data is missing the autoupdate field for packages, which the test suite expects to exist.