diff --git a/code/dataobjects/LinkMapping.php b/code/dataobjects/LinkMapping.php index 2928e91..815d87d 100644 --- a/code/dataobjects/LinkMapping.php +++ b/code/dataobjects/LinkMapping.php @@ -284,13 +284,13 @@ public function validate() { // Determine whether a regular expression mapping is possible to match against. - if(($this->LinkType === 'Regular Expression') && $result->valid() && (!$this->MappedLink || !is_numeric(@preg_match("%{$this->MappedLink}%", null)))) { + if($result->valid() && ($this->LinkType === 'Regular Expression') && (!$this->MappedLink || !is_numeric(@preg_match("%{$this->MappedLink}%", null)))) { $result->error('Invalid regular expression!'); } // Use third party validation to determine an external URL (https://gist.github.com/dperini/729294 and http://mathiasbynens.be/demo/url-regex). - if($this->ValidateExternal && $this->RedirectLink && $result->valid() && !MisdirectionService::is_external_URL($this->RedirectLink)) { + else if($result->valid() && $this->ValidateExternal && $this->RedirectLink && !MisdirectionService::is_external_URL($this->RedirectLink)) { $result->error('External URL validation failed!'); }