diff --git a/services/pypi/pypi-helpers.js b/services/pypi/pypi-helpers.js index 636e1f0f21a61..a57ea9c4f77af 100644 --- a/services/pypi/pypi-helpers.js +++ b/services/pypi/pypi-helpers.js @@ -50,6 +50,16 @@ function getLicenses(packageData) { const { info: { license }, } = packageData + + /* + The .license field may either contain + - a short license description (e.g: 'MIT' or 'GPL-3.0') or + - the full text of a license + but there is nothing in the response that tells us explicitly. + We have to make an assumption based on the length. + See https://github.com/badges/shields/issues/8689 and + https://github.com/badges/shields/pull/8690 for more info. + */ if (license && license.length < 40) { return [license] } else {