Skip to content

Commit d321186

Browse files
committed
Fix autoblacklist and loading blacklist
1 parent 2b538da commit d321186

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,13 @@ def load_blacklist(self) -> None:
167167
for line in f:
168168
if len(line.strip()) < 2 or line.strip()[0] == '#':
169169
continue
170-
self.blocked.append(line.strip().lower())
170+
self.blocked.append(line.strip().lower().replace('www.', ''))
171171

172172
def is_blocked(self, domain: str) -> bool:
173173
"""Check if domain is in blacklist"""
174174

175+
domain = domain.replace('www.', '')
176+
175177
if self.config.domain_matching == "loose":
176178
for blocked_domain in self.blocked:
177179
if blocked_domain in domain:
@@ -212,7 +214,7 @@ def is_blocked(self, domain: str) -> bool:
212214
async def check_domain(self, domain: bytes) -> None:
213215
"""Automatically check if domain is blocked"""
214216

215-
if domain in self.blocked or domain in self.whitelist:
217+
if domain.decode() in self.blocked or domain in self.whitelist:
216218
return
217219

218220
try:

0 commit comments

Comments
 (0)