Skip to content

Commit 9e1391c

Browse files
committed
Modify to remove dup. oss
1 parent 07a4fba commit 9e1391c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/fosslight_binary/_binary.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ def __init__(self, value):
2828
self.vulnerability_items = []
2929
self.binary_name_without_path = ""
3030
self.bin_name_with_path = value
31-
self.found_in_owasp = False
3231
self.is_binary = True
32+
self.found_in_owasp = False
33+
self.found_in_bin_db = False # for debugging
3334

3435
def __del__(self):
3536
pass

src/fosslight_binary/_binary_dao.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,20 @@ def get_oss_info_from_db(bin_info_list, dburl=""):
4343
for idx, row in df_result.iterrows():
4444
if not item.found_in_owasp:
4545
oss_from_db = OssItem(row['ossname'], row['ossversion'], row['license'])
46-
bin_oss_items.append(oss_from_db)
46+
47+
if bin_oss_items:
48+
for ossItem in bin_oss_items:
49+
if not (ossItem.name == oss_from_db.name and
50+
ossItem.version == oss_from_db.version and
51+
ossItem.license == oss_from_db.license):
52+
bin_oss_items.append(oss_from_db)
53+
else:
54+
bin_oss_items.append(oss_from_db)
4755

4856
if bin_oss_items:
4957
item.set_oss_items(bin_oss_items)
5058
item.comment = "Binary DB result"
59+
item.found_in_binary = True
5160

5261
disconnect_lge_bin_db()
5362
return bin_info_list, _cnt_auto_identified

0 commit comments

Comments
 (0)