mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-17 17:01:31 +00:00
Respect the provider choice of the browser plugin
This commit is contained in:
parent
c8b2db8cd3
commit
b11f4a4f9c
1 changed files with 13 additions and 7 deletions
|
|
@ -106,17 +106,23 @@ class BrowserPluginController extends AbstractController
|
||||||
{
|
{
|
||||||
$this->denyAccessUnlessGranted('@info_providers.create_parts');
|
$this->denyAccessUnlessGranted('@info_providers.create_parts');
|
||||||
|
|
||||||
$provider = (string) ($data['provider'] ?? 'generic_web');
|
$payload = $request->getPayload();
|
||||||
|
|
||||||
|
$provider = $payload->get('provider', null);
|
||||||
|
|
||||||
// The maprequestpayload already validates the URL and HTML content:
|
// The maprequestpayload already validates the URL and HTML content:
|
||||||
$token = $this->browserHtmlStorage->store($page);
|
$token = $this->browserHtmlStorage->store($page);
|
||||||
|
|
||||||
$redirectUrl = $this->generateUrl('info_providers_create_part', [
|
if ($provider !== null) {
|
||||||
'providerKey' => $provider,
|
$redirectUrl = $this->generateUrl('info_providers_create_part', [
|
||||||
'providerId' => $page->url,
|
'providerKey' => $provider,
|
||||||
'submitted_page_token' => $token,
|
'providerId' => $page->url,
|
||||||
], UrlGeneratorInterface::ABSOLUTE_URL);
|
'submitted_page_token' => $token,
|
||||||
|
], UrlGeneratorInterface::ABSOLUTE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
return new JsonResponse(['redirect_url' => $redirectUrl]);
|
return new JsonResponse([
|
||||||
|
'redirect_url' => $redirectUrl ?? null,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue