fix minor issues

This commit is contained in:
Reinier van der Leer
2026-01-31 12:16:33 +01:00
parent 8045a67869
commit 0aa2dccf93
2 changed files with 7 additions and 5 deletions

View File

@@ -354,7 +354,8 @@ def _credential_is_for_host(
if not requirements.discriminator_values:
return True
host = _extract_host_from_url(requirements.discriminator_values.pop())
# Host-scoped credential inputs are grouped by host, so any item from the set works.
host = _extract_host_from_url(list(requirements.discriminator_values)[0])
# Check that credential host matches required host
return credential.host == host

View File

@@ -19,7 +19,6 @@ from typing import (
cast,
get_args,
)
from urllib.parse import urlparse
from uuid import uuid4
from prisma.enums import CreditTransactionType, OnboardingStep
@@ -398,12 +397,14 @@ class HostScopedCredentials(_BaseCredentials):
def matches_url(self, url: str) -> bool:
"""Check if this credential should be applied to the given URL."""
parsed_url = urlparse(url)
# Extract hostname without port
request_host = parsed_url.hostname
request_host = _extract_host_from_url(url)
if not request_host:
return False
if ":" not in self.host:
# No port specified in credential host, ignore port from request host
request_host = request_host.rsplit(":", 1)[0]
# Simple host matching - exact match or wildcard subdomain match
if self.host == request_host:
return True