From 99ed3a9a8dbaaa2ae311d017ebc4d1ba7c5c9d27 Mon Sep 17 00:00:00 2001 From: Stefan Fleckenstein Date: Mon, 29 Apr 2024 14:08:47 +0200 Subject: [PATCH] fix: clip dependencies directly to maximum size --- .../import_observations/parsers/cyclone_dx/dependencies.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/application/import_observations/parsers/cyclone_dx/dependencies.py b/backend/application/import_observations/parsers/cyclone_dx/dependencies.py index e28d57040..5e841a828 100644 --- a/backend/application/import_observations/parsers/cyclone_dx/dependencies.py +++ b/backend/application/import_observations/parsers/cyclone_dx/dependencies.py @@ -10,7 +10,7 @@ def get_component_dependencies( components: dict[str, Component], component: Component, metadata: Metadata, -): +) -> tuple[str, list[dict]]: component_dependencies: list[dict[str, str | list[str]]] = [] _filter_component_dependencies( component.bom_ref, @@ -33,6 +33,11 @@ def get_component_dependencies( ) ) + if len(observation_component_dependencies) > 4096: + observation_component_dependencies = ( + observation_component_dependencies[:4092] + " ..." + ) + return observation_component_dependencies, translated_component_dependencies