@@ -15,7 +15,7 @@ class CPESpecial(Enum):
15
15
def parse_cpe22 (cpe : str ) -> tuple [CPEValue , CPEValue , CPEValue , CPEValue ]:
16
16
"""Parse a CPE 2.2 URI"""
17
17
18
- if not cpe .startswith ("cpe:/" ):
18
+ if not cpe .lower (). startswith ("cpe:/" ):
19
19
raise ValueError ("invalid cpe format" )
20
20
components = []
21
21
for part in cpe [5 :].split (":" ):
@@ -33,7 +33,7 @@ def parse_cpe22(cpe: str) -> tuple[CPEValue, CPEValue, CPEValue, CPEValue]:
33
33
def parse_cpe23 (cpe : str ) -> tuple [CPEValue , CPEValue , CPEValue , CPEValue ]:
34
34
"""Parse a CPE 2.3 string, also partial CPEs and missing components are treated as ANY."""
35
35
36
- if not cpe .startswith ("cpe:2.3:" ):
36
+ if not cpe .lower (). startswith ("cpe:2.3:" ):
37
37
raise ValueError ("invalid cpe format" )
38
38
39
39
def split_and_unquote (s : str ) -> list [CPEValue ]:
@@ -80,9 +80,9 @@ def push():
80
80
def parse_cpe (cpe : str ) -> tuple [CPEValue , CPEValue , CPEValue , CPEValue ]:
81
81
"""Parse a CPE string into a tuple for the first four components"""
82
82
83
- if cpe .startswith ("cpe:2.3:" ):
83
+ if cpe .lower (). startswith ("cpe:2.3:" ):
84
84
return parse_cpe23 (cpe )
85
- elif cpe .startswith ("cpe:/" ):
85
+ elif cpe .lower (). startswith ("cpe:/" ):
86
86
return parse_cpe22 (cpe )
87
87
else :
88
88
raise ValueError ("unknown cpe format" )
0 commit comments