From 2305220bc99c49cd7fc400719a674e408b688678 Mon Sep 17 00:00:00 2001 From: Mint <> Date: Mon, 8 Aug 2022 13:54:17 +0300 Subject: [PATCH] Handle IDNs in API --- api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api.py b/api.py index ee08cb5..cd302ef 100644 --- a/api.py +++ b/api.py @@ -38,7 +38,8 @@ def blocked(domain: str = None, reason: str = None): c = conn.cursor() if domain != None: wildchar = "*." + ".".join(domain.split(".")[-domain.count("."):]) - c.execute("select blocker, block_level, reason from blocks where blocked = ? or blocked = ? or blocked = ? or blocked = ?", (domain, "*." + domain, wildchar, get_hash(domain))) + c.execute("select blocker, block_level, reason from blocks where blocked = ? or blocked = ? or blocked = ? or blocked = ? or blocked = ? or blocked = ?", + (domain, "*." + domain, wildchar, get_hash(domain), domain.encode('idna'), "*." + domain.encode('idna'))) else: c.execute("select * from blocks where reason like ? and reason != ''", ("%"+reason+"%",)) blocks = c.fetchall() -- 2.39.5