Skip to content

Commit dfe1d04

Browse files
authored
Merge pull request #143 from fosslight/exclude
Handling of exceeding max. url length
2 parents f11dbe4 + 02c3cf1 commit dfe1d04

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/fosslight_binary/_binary.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@
44
# SPDX-License-Identifier: Apache-2.0
55
from fosslight_util.oss_item import FileItem
66
import urllib.parse
7+
import logging
8+
import fosslight_util.constant as constant
79

810
EXCLUDE_TRUE_VALUE = "Exclude"
911
TLSH_CHECKSUM_NULL = "0"
12+
MAX_EXCEL_URL_LENGTH = 255
13+
14+
logger = logging.getLogger(constant.LOGGER_NAME)
1015

1116

1217
class VulnerabilityItem:
@@ -58,6 +63,11 @@ def get_print_array(self):
5863
lic = ",".join(oss.license)
5964
exclude = EXCLUDE_TRUE_VALUE if (self.exclude or oss.exclude) else ""
6065
nvd_url = self.get_vulnerability_items()
66+
if nvd_url and len(nvd_url) > MAX_EXCEL_URL_LENGTH:
67+
logger.info(f"self.source_name_or_path: {self.source_name_or_path}")
68+
logger.info(f"oss name: {oss.name}")
69+
logger.info(f"length_url:{len(nvd_url)}, nvd_url: {nvd_url}")
70+
nvd_url = nvd_url[:242] + '...(truncated)'
6171
items.append([self.source_name_or_path, oss.name, oss.version,
6272
lic, oss.download_location, oss.homepage,
6373
oss.copyright, exclude, oss.comment,

0 commit comments

Comments
 (0)