Skip to content

Commit c777e84

Browse files
author
Sebastian Wagner
committed
ENH: harm: simplify TLP sanitiation
the value is upper-case only already, so remove the case-insensitive code
1 parent dc4060e commit c777e84

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

intelmq/lib/harmonization.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ class TLP(UppercaseString):
11601160
Accepted for sanitation are different cases and the prefix 'tlp:'.
11611161
"""
11621162
enum = ['WHITE', 'GREEN', 'AMBER', 'RED']
1163-
prefix_pattern = re.compile(r'^(TLP:?)?\s*', flags=re.IGNORECASE)
1163+
prefix_pattern = re.compile(r'^(TLP:?)?\s*')
11641164

11651165
@staticmethod
11661166
def is_valid(value: str, sanitize: bool = False) -> bool:
@@ -1180,6 +1180,6 @@ def sanitize(value: str) -> Optional[str]:
11801180
value = UppercaseString.sanitize(value)
11811181
if value:
11821182
value = TLP.prefix_pattern.sub('', value)
1183-
if value.lower() == 'yellow':
1183+
if value == 'YELLOW':
11841184
value = 'AMBER'
11851185
return value

0 commit comments

Comments
 (0)