@@ -20,8 +20,7 @@ def is_vcs_url_already_processed(commit_id):
2020 """
2121 Check if a VCS URL exists in a CodeFix entry.
2222 """
23- if "commit" in commit_id :
24- return CodeFix .objects .filter (commits__contains = [commit_id ]).exists ()
23+ return CodeFix .objects .filter (commits__contains = [commit_id ]).exists ()
2524
2625
2726class CollectFixCommitsPipeline (VulnerableCodePipeline ):
@@ -57,6 +56,8 @@ def collect_and_store_fix_commits(self):
5756 ):
5857 vulnerability = apv .vulnerability
5958 for reference in vulnerability .references .all ():
59+ if not "/commit/" in reference .url :
60+ continue
6061 if not is_vcs_url (reference .url ):
6162 continue
6263
@@ -72,17 +73,16 @@ def collect_and_store_fix_commits(self):
7273 )
7374 continue
7475 # check if vcs_url has commit
75- if "/commit/" in vcs_url :
76- code_fix , created = CodeFix .objects .get_or_create (
77- commits = [vcs_url ],
78- affected_package_vulnerability = apv ,
79- )
76+ code_fix , created = CodeFix .objects .get_or_create (
77+ commits = [vcs_url ],
78+ affected_package_vulnerability = apv ,
79+ )
8080
81- if created :
82- created_fix_count += 1
83- self .log (
84- f"Created CodeFix entry for reference: { reference .url } with VCS URL { vcs_url } "
85- )
81+ if created :
82+ created_fix_count += 1
83+ self .log (
84+ f"Created CodeFix entry for reference: { reference .url } with VCS URL { vcs_url } "
85+ )
8686
8787 self .log (f"Successfully created { created_fix_count :,d} CodeFix entries." )
8888
0 commit comments