Skip to content

Commit

Permalink
Fix rule.includes() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
xkww3n committed Nov 5, 2023
1 parent acf1e66 commit 416c946
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Utils/rule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import copy
from copy import copy
import logging
from pathlib import Path

Expand Down Expand Up @@ -27,8 +27,12 @@ def __eq__(self, other):
return self.Type == other.Type and self.Payload == other.Payload

def includes(self, other):
return ("." + other.Payload if other.Type == "DomainSuffix" else other.Payload).endswith(
"." + self.Payload if self.Type == "DomainSuffix" else self.Payload)
if self.Type == "DomainSuffix":
if self.Payload == other.Payload:
return True
return other.Payload.endswith("." + self.Payload)
elif self.Type == "DomainFull":
return self == other


class RuleSet:
Expand Down Expand Up @@ -61,7 +65,7 @@ def __iter__(self):
return iter(self.Payload)

def copy(self):
return copy.copy(self)
return copy(self)

def add(self, rule):
self.Payload.append(rule)
Expand Down

0 comments on commit 416c946

Please sign in to comment.