From 7c9ab8ebe992639a76b54810f5b3f7f5b614e65d Mon Sep 17 00:00:00 2001
From: Bernd Oliver Suenderhauf <bos@suenderhauf.de>
Date: Mon, 15 Apr 2019 02:02:19 +0200
Subject: [PATCH] Issue #3046427 by Pancho, wizonesolutions: Redirect to
 '<front>' rather than to '/'

---
 src/Controller/HandlePdfController.php               | 3 ++-
 src/Plugin/FillPdfActionPlugin/FillPdfSaveAction.php | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/Controller/HandlePdfController.php b/src/Controller/HandlePdfController.php
index 94c81c2..2e2eb87 100644
--- a/src/Controller/HandlePdfController.php
+++ b/src/Controller/HandlePdfController.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\fillpdf\Controller;
 
+use Drupal\Core\Url;
 use Drupal\Core\Controller\ControllerBase;
 use Drupal\file\Entity\File;
 use Drupal\file\FileInterface;
@@ -126,7 +127,7 @@ class HandlePdfController extends ControllerBase {
     $fillpdf_form = FillPdfForm::load($context['fid']);
     if (!$fillpdf_form) {
       $this->messenger->addError($this->t('FillPDF Form (fid) not found in the system. Please check the value in your FillPDF Link.'));
-      return new RedirectResponse('/');
+      return new RedirectResponse(Url::fromRoute('<front>')->toString());
     }
 
     $fields = $fillpdf_form->getFormFields();
diff --git a/src/Plugin/FillPdfActionPlugin/FillPdfSaveAction.php b/src/Plugin/FillPdfActionPlugin/FillPdfSaveAction.php
index b908a64..4dc475d 100644
--- a/src/Plugin/FillPdfActionPlugin/FillPdfSaveAction.php
+++ b/src/Plugin/FillPdfActionPlugin/FillPdfSaveAction.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\fillpdf\Plugin\FillPdfActionPlugin;
 
+use Drupal\Core\Url;
 use Drupal\fillpdf\OutputHandler;
 use Drupal\fillpdf\Plugin\FillPdfActionPluginBase;
 use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -68,7 +69,7 @@ class FillPdfSaveAction extends FillPdfActionPluginBase {
     $this->savePdf();
 
     // @todo: Fix based on value of post_save_redirect, once I add that
-    $response = new RedirectResponse('/');
+    $response = new RedirectResponse(Url::fromRoute('<front>')->toString());
     return $response;
   }
 
-- 
GitLab