LibraryManager
LibraryManager copied to clipboard
Should not place unusable responses from providers into metadata cache
Describe the bug
To Reproduce
Steps to reproduce the behavior:
- Download a library but get an invalid (unparseable) JSON response from the provider
- Try again, expecting the retry to return a valid JSON payload
Operation fails again, because the bad response is placed in the cache, so we keep reusing it.
Expected behavior
Should issue the request to the provider again, and get a fresh (hopefully functional) response.
Just retry the request may not be enough to fix the issue. I tested a few times and found the provider's CDN will return the same broken JSON for a same IP and user agent. To force the provider to return a fresh response, libman may need to have a method to make CDN think it is not the same client.
Libman can't change client IP, so there may be two options to force CDN to refresh
- Append a random number to the query string like:
https://api.cdnjs.com/libraries/tinymce?996
- Add a random user agent string to the request header