Skip to content

Commit 7060b71

Browse files
committed
fix: Don't append /'s errantly to URLs that have fragments in them if addTrailingSlashesToUrls is set to true in config/general.php
1 parent 429367b commit 7060b71

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/controllers/RedirectsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ public function actionDeleteShortlinks()
409409
protected function addSlashToSiteUrls(string $url): string
410410
{
411411
// Make sure the URL doesn't end with a file extension, e.g.: .jpg or have a query string
412-
if (!preg_match('/\.[^\/]+$/', $url) && strpos($url, '?') === false) {
412+
if (!preg_match('/\.[^\/]+$/', $url) && strpos($url, '?') === false && strpos($url, '#') === false) {
413413
// If it's a root relative URL, assume it's a site URL
414414
if (UrlHelper::isRootRelativeUrl($url)) {
415415
return rtrim($url, '/') . '/';

0 commit comments

Comments
 (0)