Skip to content

Commit

Permalink
[BUGFIX] Prevent double slash after hostname
Browse files Browse the repository at this point in the history
TYPO3_SITE_PATH is usually just '/' but could be something like '/my-site/' which comes
with slashes on both ends.

Related: #1014
Related: #1015
  • Loading branch information
kitzberger authored and mschwemer committed May 21, 2024
1 parent d4041f6 commit e54b80d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Classes/ViewHelpers/Misc/LinkViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ public function render(): string
if ($this->arguments['absolute'] === true) {
$uri .= parse_url(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), PHP_URL_SCHEME);
$uri .= '://' . GeneralUtility::getIndpEnv('HTTP_HOST') . '/';
$uri .= rtrim(GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'), '/');
$uri .= trim(GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'), '/');
}
return $uri . $path;

return rtrim($uri, '/') . '/' . ltrim($path, '/');
}
}

0 comments on commit e54b80d

Please sign in to comment.