fix: the field is pre-filled with the requested domain name

This commit is contained in:
Maël Gangloff
2024-12-29 18:06:28 +01:00
parent 45e218c322
commit 16e3d3b33a
3 changed files with 18 additions and 12 deletions

View File

@@ -41,9 +41,7 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
readonly class RDAPService
{
/**
* @see https://www.iana.org/domains/root/db
*/
/* @see https://www.iana.org/domains/root/db */
public const ISO_TLD_EXCEPTION = ['ac', 'eu', 'uk', 'su', 'tp'];
public const INFRA_TLD = ['arpa'];
public const SPONSORED_TLD = [
@@ -175,9 +173,14 @@ readonly class RDAPService
if (false === $lastDotPosition) {
throw new BadRequestException('Domain must contain at least one dot');
}
$tld = strtolower(idn_to_ascii(substr($domain, $lastDotPosition + 1)));
return $this->tldRepository->findOneBy(['tld' => $tld]);
$tld = strtolower(idn_to_ascii(substr($domain, $lastDotPosition + 1)));
$tldEntity = $this->tldRepository->findOneBy(['tld' => $tld]);
if (null === $tldEntity) {
throw new NotFoundHttpException("The requested TLD is not yet supported, please try again with another one");
}
return $tldEntity;
}
private function convertToIdn(string $fqdn): string