From c61a64fb82249ee55eaaeddd99533d3df470d8b6 Mon Sep 17 00:00:00 2001 From: Nathan Glasl Date: Tue, 12 Feb 2019 10:03:03 +1100 Subject: [PATCH] [FIX] The validation now checks for empty vanity mappings. --- README.md | 2 +- src/extensions/SiteTreeMisdirectionExtension.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 76098af..0bd0567 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # [misdirection](https://packagist.org/packages/nglasl/silverstripe-misdirection) -_The current release is **3.1.0**_ +_The current release is **3.1.1**_ > This module allows both simple and regular expression link redirections based on customisable mappings, either hooking into a page not found or replacing the default automated URL handling. diff --git a/src/extensions/SiteTreeMisdirectionExtension.php b/src/extensions/SiteTreeMisdirectionExtension.php index 592f52a..0ea127f 100644 --- a/src/extensions/SiteTreeMisdirectionExtension.php +++ b/src/extensions/SiteTreeMisdirectionExtension.php @@ -55,6 +55,9 @@ public function validate(ValidationResult $result) { // Retrieve the vanity mapping URL, where this is only possible using the POST variable. $vanityURL = (!Controller::has_curr() || is_null($controller = Controller::curr()) || is_null($URL = $controller->getRequest()->postVar('VanityURL'))) ? $this->owner->VanityMapping()->MappedLink : $URL; + if(!$vanityURL) { + return $result; + } // Determine whether another vanity mapping already exists.