fix(api): skip the local geoblock for a relayed tag not installed here

This commit is contained in:
imSp4rky
2026-11-01 20:06:09 -07:00
parent 99f0c269be
commit de9646dba2
2 changed files with 8 additions and 1 deletions
@@ -63,6 +63,11 @@ def test_region_match_no_proxy(monkeypatch):
assert handlers.resolve_handler_proxy({"client_region": "ca"}, "EXAMPLE", request("plainkey")) == (None, [])
def test_relayed_tag_not_installed_here_skips_the_local_geoblock(monkeypatch):
patch_server_region(monkeypatch, "CA")
assert handlers.resolve_handler_proxy({"client_region": "ca"}, "NOTHERE", request("plainkey")) == (None, [])
def test_region_unknown_no_error(monkeypatch):
patch_server_region(monkeypatch, None)
assert handlers.resolve_handler_proxy({"client_region": "ca"}, "EXAMPLE", request("plainkey")) == (None, [])
+3 -1
View File
@@ -4686,7 +4686,9 @@ def resolve_handler_proxy(
log.debug(f"Server region lookup failed: {e!r}")
server_region = None
geoblock = getattr(Services.load(normalized_service), "GEOBLOCK", ()) or ()
geoblock: Any = ()
with suppress(KeyError): # a relayed tag need not be installed on this server
geoblock = getattr(Services.load(normalized_service), "GEOBLOCK", ()) or ()
if client_region.lower() in {x.lower() for x in geoblock}:
raise APIError(
APIErrorCode.GEOFENCE,