Skip to content

Commit

Permalink
Route, SimpleRouter: fixed generating malformed URL without authority
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Feb 13, 2019
1 parent a4d8097 commit 6e90be9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Routing/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,10 @@ public function constructUrl(array $params, Nette\Http\UrlScript $refUrl): ?stri

// absolutize path
if ($this->type === self::RELATIVE) {
$url = '//' . $refUrl->getAuthority() . $refUrl->getBasePath() . $url;
$url = (($tmp = $refUrl->getAuthority()) ? "//$tmp" : '') . $refUrl->getBasePath() . $url;

} elseif ($this->type === self::PATH) {
$url = '//' . $refUrl->getAuthority() . $url;
$url = (($tmp = $refUrl->getAuthority()) ? "//$tmp" : '') . $url;

} else {
$host = $refUrl->getHost();
Expand Down
2 changes: 1 addition & 1 deletion src/Routing/SimpleRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function constructUrl(array $params, Nette\Http\UrlScript $refUrl): ?stri
}
}

$url = $refUrl->getScheme() . '://' . $refUrl->getAuthority() . $refUrl->getPath();
$url = $refUrl->getHostUrl() . $refUrl->getPath();
$sep = ini_get('arg_separator.input');
$query = http_build_query($params, '', $sep ? $sep[0] : '&');
if ($query != '') { // intentionally ==
Expand Down

0 comments on commit 6e90be9

Please sign in to comment.