joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.77k stars 3.65k forks source link

[6.0] Router: Enforce suffix by default if enabled #44480

Open Hackwar opened 3 days ago

Hackwar commented 3 days ago

Summary of Changes

This PR changes the feature introduced in 5.2.0 to be able to enforce a suffix ending if it is enabled and makes this the standard behavior. It removes the option from the SEF plugin and moves the code to the SiteRouter class, at the same time using the "tainted URL" feature from #44455 to prevent unnecessary redirects.

Testing Instructions

  1. Enable SEF URLs with suffix ending.
  2. Open a random URL of the site and remove the suffix
  3. Open a random URL of the site and replace the suffix with something else and add ?format=html to the URL
  4. Open a random URL of the site, remove the suffix and add ?format=html to the URL

Actual result BEFORE applying this Pull Request

Joomla loads all the URLs without any redirects.

Expected result AFTER applying this Pull Request

All URLs are redirected to the version with .html at the end.

Link to documentations

Please select:

HLeithner commented 1 day ago

I have tested this item :red_circle: unsuccessfully on 9873b7744faf22e10f6dc742cf6f58f526f653d8

* install pr

Expected a smooths transition, at least not a fatal error



#   Function    Location
1   ()  JROOT/libraries/src/Router/SiteRouter.php:203
2   Joomla\CMS\Router\SiteRouter->parseFormat() JROOT/libraries/src/Router/Router.php:384
3   Joomla\CMS\Router\Router->processParseRules()   JROOT/libraries/src/Router/Router.php:144
4   Joomla\CMS\Router\Router->parse()   JROOT/libraries/src/Application/SiteApplication.php:738
5   Joomla\CMS\Application\SiteApplication->route() JROOT/libraries/src/Application/SiteApplication.php:243
6   Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:306
7   Joomla\CMS\Application\CMSApplication->execute()    JROOT/includes/app.php:58
8   require_once()  JROOT/index.php:32
```<hr /><sub>This comment was created with the <a href="https://github.com/joomla/jissues">J!Tracker Application</a> at <a href="https://issues.joomla.org/tracker/joomla-cms/44480">issues.joomla.org/tracker/joomla-cms/44480</a>.</sub>
Hackwar commented 1 day ago

That is why it says "tainted URL" feature from #44455 and since that PR is not merged yet, this PR indeed fails.

HLeithner commented 21 hours ago

I changed this to draft since it's not ready