Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not forward to dropdown controller if a front script exists #17935

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Glpi/Http/LegacyAssetsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ public function onKernelRequest(RequestEvent $event): void
{
$request = $event->getRequest();

if (
$request->attributes->get('_controller') !== null
|| $event->getResponse() !== null
) {
// A controller or a response has already been defined for this request, do not override them.
return;
}

$response = $this->serveLegacyAssets($request);

if ($response) {
Expand Down
8 changes: 8 additions & 0 deletions src/Glpi/Http/LegacyDropdownRouteListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ public function onKernelRequest(RequestEvent $event): void
}
$request = $event->getRequest();

if (
$request->attributes->get('_controller') !== null
|| $event->getResponse() !== null
) {
// A controller or a response has already been defined for this request, do not override them.
return;
}

if ($class = $this->findDropdownClass($request)) {
$is_form = \str_ends_with($request->getPathInfo(), '.form.php');

Expand Down
8 changes: 8 additions & 0 deletions src/Glpi/Http/LegacyRouterListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ public function onKernelRequest(RequestEvent $event): void

$request = $event->getRequest();

if (
$request->attributes->get('_controller') !== null
|| $event->getResponse() !== null
) {
// A controller or a response has already been defined for this request, do not override them.
return;
}

$response = $this->runLegacyRouter($request);

if ($response) {
Expand Down
2 changes: 2 additions & 0 deletions src/Glpi/Http/ListenersPriority.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ final class ListenersPriority
LegacyConfigProviderListener::class => 350,

// Plugins dropdowns requires plugins to be initialized, therefore config must be already set.
// Also, keep it after the `LegacyRouterListener` to not map to the generic dropdown controller if a
// legacy script exists for the requested URI.
LegacyDropdownRouteListener::class => 300,
];

Expand Down