mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Added system config option legacy_url_root_behavior
This commit is contained in:
parent
b80fcca0cf
commit
4f92568171
|
|
@ -5,6 +5,7 @@
|
|||
* Added support to get image size for SVG vector images [#3533](https://github.com/getgrav/grav/pull/3533)
|
||||
* Added XSS check for uploaded SVG files before they get stored
|
||||
* Fixed phpstan issues (All level 2, Framework level 5)
|
||||
* Added a `system.legacy_url_root_behavior` config option to enable legacy/broken `Utils::url()` behavior
|
||||
2. [](#bugfix)
|
||||
* Fixed `'mbstring' extension is not loaded` error, use Polyfill instead [#3504](https://github.com/getgrav/grav/pull/3504)
|
||||
* Fixed new `Utils::pathinfo()` and `Utils::basename()` being too strict for legacy use [#3542](https://github.com/getgrav/grav/issues/3542)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ http_x_forwarded: # Configuration options for the
|
|||
host: false
|
||||
port: true
|
||||
ip: true
|
||||
legacy_url_root_behavior: false # Enable legacy root URL behavior that breaks URls with paths that match root
|
||||
|
||||
languages:
|
||||
supported: [] # List of languages supported. eg: [en, fr, de]
|
||||
|
|
|
|||
|
|
@ -134,14 +134,15 @@ abstract class Utils
|
|||
$resource = $locator->findResource($input, false);
|
||||
}
|
||||
} else {
|
||||
// $root = $uri->rootUrl();
|
||||
// $pattern = '/(' . '\\' . $root . '[\s\/])/';
|
||||
// if (preg_match($pattern, $input, $matches)) {
|
||||
// $input = static::replaceFirstOccurrence($matches[0], '', $input);
|
||||
// }
|
||||
// You can manually restore the old legacy behavior that does not produce expected results
|
||||
if ($grav['config']->get('system.legacy_url_root_behavior', false)) {
|
||||
$root = $uri->rootUrl();
|
||||
if (static::startsWith($input, $root)) {
|
||||
$input = static::replaceFirstOccurrence($root, '', $input);
|
||||
}
|
||||
}
|
||||
|
||||
$input = ltrim($input, '/');
|
||||
|
||||
$resource = $input;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user