Skip to content
Snippets Groups Projects
Commit 647630fa authored by dmitriy.trt's avatar dmitriy.trt Committed by Ted Cooper
Browse files

[#1694022] by dmitriy.trt: Support empty verification file.

parent 585a4dc5
No related branches found
No related tags found
1 merge request!12[#1694022] by dmitriy.trt: Support empty verification file.
Pipeline #329660 passed with warnings
......@@ -14,6 +14,7 @@ use Drupal\Core\Url;
use Drupal\site_verify\Service\SiteVerifyService;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Returns responses for Site Verify module routes.
......@@ -103,10 +104,13 @@ class SiteVerifyController implements ContainerInjectionInterface {
*
* @return \Symfony\Component\HttpFoundation\Response
* The response containing the Verification File content.
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* In the event file is
*/
public function verificationsFileContent($svid) {
$verification = $this->siteVerifyService->siteVerifyLoad($svid);
if ($verification['file_contents'] && $verification['engine']['file_contents']) {
if ($verification['file'] && $verification['engine']['file_contents']) {
$response = new Response(
$verification['file_contents'],
200,
......@@ -114,15 +118,9 @@ class SiteVerifyController implements ContainerInjectionInterface {
);
return $response;
}
else {
$build = [];
$build['#title'] = $this->t('Verification page');
$build['#markup'] = $this->t('This is a verification page for the !title search engine.', [
'!title' => $verification['engine']['name'],
]);
return $build;
}
// Not a file verification.
throw new NotFoundHttpException();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment