Skip to content

Commit 11d5cfa

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 de9e66f commit 11d5cfa

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
@@ -406,7 +406,7 @@ public function actionDeleteShortlinks()
406406
protected function addSlashToSiteUrls(string $url): string
407407
{
408408
// Make sure the URL doesn't end with a file extension, e.g.: .jpg or have a query string
409-
if (!preg_match('/\.[^\/]+$/', $url) && strpos($url, '?') === false) {
409+
if (!preg_match('/\.[^\/]+$/', $url) && strpos($url, '?') === false && strpos($url, '#') === false) {
410410
// If it's a root relative URL, assume it's a site URL
411411
if (UrlHelper::isRootRelativeUrl($url)) {
412412
return rtrim($url, '/') . '/';

0 commit comments

Comments
 (0)