mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix minor issues
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user