Cms: Cannot use route with one letter for Multisites

Created on 3 Feb 2020  路  1Comment  路  Source: craftcms/cms

Description

https://test.com/ --> primary site (works fine!)
https://test.com/r/ --> multisite (doesn't work!)
https://test.com/rx/ --> multisite (works fine, but is not, what we want)

Problem

// It's a possible match!
$scores[$i] = 8 + strlen($parsedPath);

...

// One Pence point if it's the primary site in case we need a tiebreaker
if ($site->primary) {
    $scores[$i]++;
}

see: https://github.com/craftcms/cms/blob/develop/src/web/Request.php starting from line 1191.

When the $parsedPath is only 1 letter, it has the same score as the primary site and thus the arsort($scores, SORT_NUMERIC) in line 1219 will not sort the sites correctly.

Most helpful comment

Thanks for reporting that! We just released Craft 3.4.3 with a fix for it.

>All comments

Thanks for reporting that! We just released Craft 3.4.3 with a fix for it.

Was this page helpful?
0 / 5 - 0 ratings