Merge pull request #5970 from open-sausages/pulls/4.0/fix-folder-validate

BUG Fix issue with Folder::validate() failing on allowed_extensions
This commit is contained in:
Daniel Hensby 2016-09-08 11:44:31 +01:00 committed by GitHub
commit 1b6242ac64
2 changed files with 8 additions and 1 deletions

View File

@ -997,7 +997,7 @@ class File extends DataObject implements ShortcodeHandler, AssetContainer, Thumb
} }
public function validate() { public function validate() {
$result = new ValidationResult(); $result = ValidationResult::create();
$this->File->validate($result, $this->Name); $this->File->validate($result, $this->Name);
$this->extend('validate', $result); $this->extend('validate', $result);
return $result; return $result;

View File

@ -9,6 +9,7 @@ use SilverStripe\Forms\HiddenField;
use SilverStripe\Forms\LiteralField; use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\TextField; use SilverStripe\Forms\TextField;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\ValidationResult;
use SilverStripe\ORM\Versioning\Versioned; use SilverStripe\ORM\Versioning\Versioned;
/** /**
@ -325,4 +326,10 @@ class Folder extends File {
public function StripThumbnail() { public function StripThumbnail() {
return null; return null;
} }
public function validate() {
$result = ValidationResult::create();
$this->extend('validate', $result);
return $result;
}
} }