Skip to content

Commit 17173e2

Browse files
authored
Merge pull request #2654 from kdambekalns/bugfix/wrong-port-for-resolved-shortcut
BUGFIX: Wrong port assigned in applyTo()
2 parents 9c61b42 + 89978ee commit 17173e2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Neos.Flow/Classes/Mvc/Routing/Dto/UriConstraints.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ public function applyTo(UriInterface $baseUri, bool $forceAbsoluteUri): UriInter
337337
$uri = $uri->withHost($baseUri->getHost());
338338
}
339339
if (empty($uri->getPort()) && !isset($this->constraints[self::CONSTRAINT_PORT])) {
340-
$port = $baseUri->getPort() ?? UriHelper::getDefaultPortForScheme($baseUri->getScheme());
340+
$port = $baseUri->getPort() ?? UriHelper::getDefaultPortForScheme($uri->getScheme());
341341
$uri = $uri->withPort($port);
342342
}
343343
}

Neos.Flow/Tests/Unit/Mvc/Routing/Dto/UriConstraintsTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public function applyToDataProvider()
3737
{
3838
return [
3939
['constraints' => [UriConstraints::CONSTRAINT_SCHEME => 'http'], 'templateUri' => 'http://some-domain.tld', 'forceAbsoluteUri' => false, 'expectedUri' => '/'],
40-
['constraints' => [UriConstraints::CONSTRAINT_SCHEME => 'https'], 'templateUri' => 'http://some-domain.tld', 'forceAbsoluteUri' => false, 'expectedUri' => 'https://some-domain.tld:80/'],
40+
['constraints' => [UriConstraints::CONSTRAINT_SCHEME => 'https'], 'templateUri' => 'http://some-domain.tld', 'forceAbsoluteUri' => false, 'expectedUri' => 'https://some-domain.tld/'],
41+
['constraints' => [UriConstraints::CONSTRAINT_SCHEME => 'https', UriConstraints::CONSTRAINT_PORT => 80], 'templateUri' => 'http://some-domain.tld', 'forceAbsoluteUri' => false, 'expectedUri' => 'https://some-domain.tld:80/'],
4142

4243
['constraints' => [UriConstraints::CONSTRAINT_HOST => 'some-domain.tld'], 'templateUri' => 'http://some-domain.tld', 'forceAbsoluteUri' => false, 'expectedUri' => '/'],
4344
['constraints' => [UriConstraints::CONSTRAINT_HOST => 'some-other-domain.tld'], 'templateUri' => 'http://some-domain.tld', 'forceAbsoluteUri' => false, 'expectedUri' => 'http://some-other-domain.tld/'],

0 commit comments

Comments
 (0)