Skip to content

Commit

Permalink
Improve IDN feature
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Aug 2, 2023
1 parent 0301768 commit 3d0a6e3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
use League\Uri\Exceptions\IdnSupportMissing;
use League\Uri\Exceptions\SyntaxError;
use League\Uri\Idna\Idna;
use League\Uri\Idna\IdnaOption;
use League\Uri\UriTemplate\TemplateCanNotBeExpanded;
use Psr\Http\Message\UriInterface as Psr7UriInterface;
use SensitiveParameter;
Expand Down Expand Up @@ -339,11 +338,11 @@ private function formatHost(?string $host): ?string
private function formatRegisteredName(string $host): string
{
$formatter = static function (string $host) {
$info = Idna::toAscii($host, IdnaOption::forIDNA2008Ascii());
$info = Idna::toAscii($host);

return match (true) {
$info->hasErrors() => throw IdnaConversionFailed::dueToIDNAError($host, $info),
default => $info->result(),
default => $info->domain(),
};
};
$formattedHost = rawurldecode($host);
Expand Down

0 comments on commit 3d0a6e3

Please sign in to comment.