mirror of
https://github.com/getgrav/grav.git
synced 2026-05-07 00:06:37 +02:00
Only redirect GET/HEAD if system.pages.redirect_trailing_slash is true and request has a trailing slash
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
* Fixed renaming flex objects key when using file storage
|
||||
* Fixed wrong values in Admin pages list [#3214](https://github.com/getgrav/grav/issues/3214)
|
||||
* Fixed pipelined asset using different hash when extra asset is added to before/after position [#2781](https://github.com/getgrav/grav/issues/2781)
|
||||
* Only redirect GET/HEAD if `system.pages.redirect_trailing_slash` is true and request has a trailing slash
|
||||
|
||||
# v1.7.5
|
||||
## 02/01/2021
|
||||
|
||||
@@ -30,6 +30,7 @@ use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
use function defined;
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
* Class InitializeProcessor
|
||||
@@ -414,6 +415,10 @@ class InitializeProcessor extends ProcessorBase
|
||||
|
||||
protected function handleRedirectRequest(RequestInterface $request): ?ResponseInterface
|
||||
{
|
||||
if (!in_array($request->getMethod(), ['GET', 'HEAD'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Redirect pages with trailing slash if configured to do so.
|
||||
$uri = $request->getUri();
|
||||
$path = $uri->getPath() ?: '/';
|
||||
|
||||
Reference in New Issue
Block a user