From 4da9e7d58fc7a5fcd4677e76b5633942dd0a8631 Mon Sep 17 00:00:00 2001 From: chris48s <chris48s@users.noreply.github.com> Date: Sat, 10 Dec 2022 13:02:14 +0000 Subject: [PATCH] fall back to classifiers if license text is really long (#8690) --- services/pypi/pypi-helpers.js | 2 +- services/pypi/pypi-helpers.spec.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/services/pypi/pypi-helpers.js b/services/pypi/pypi-helpers.js index 706955b4f9..636e1f0f21 100644 --- a/services/pypi/pypi-helpers.js +++ b/services/pypi/pypi-helpers.js @@ -50,7 +50,7 @@ function getLicenses(packageData) { const { info: { license }, } = packageData - if (license) { + if (license && license.length < 40) { return [license] } else { const parenthesizedAcronymRegex = /\(([^)]+)\)/ diff --git a/services/pypi/pypi-helpers.spec.js b/services/pypi/pypi-helpers.spec.js index 17e42b3b4f..b12b61ac46 100644 --- a/services/pypi/pypi-helpers.spec.js +++ b/services/pypi/pypi-helpers.spec.js @@ -116,6 +116,13 @@ describe('PyPI helpers', function () { classifiers: ['License :: OSI Approved :: MIT License'], }, }), + given({ + info: { + license: + 'this text is really really really really really really long', + classifiers: ['License :: OSI Approved :: MIT License'], + }, + }), given({ info: { license: '', -- GitLab