From c28b13f427e28685f2a20d57abc85e54488151c0 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 15 Oct 2024 18:24:33 +1300 Subject: [PATCH] API Update validation methods --- src/File.php | 2 +- src/Storage/DBFile.php | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/File.php b/src/File.php index 03fca21b..b2a19c88 100644 --- a/src/File.php +++ b/src/File.php @@ -1180,7 +1180,7 @@ public function getAbsoluteSize() public function validate() { $result = ValidationResult::create(); - $this->File->validate($result, $this->Name); + $this->File->validateFilename($result, $this->Name); $this->extend('updateValidate', $result); return $result; } diff --git a/src/Storage/DBFile.php b/src/Storage/DBFile.php index 26d758a4..1302220e 100644 --- a/src/Storage/DBFile.php +++ b/src/Storage/DBFile.php @@ -454,19 +454,18 @@ protected function isValidFilename(string $filename): bool protected function assertFilenameValid(string $filename): void { $result = new ValidationResult(); - $this->validate($result, $filename); + $this->validateFilename($result, $filename); if (!$result->isValid()) { throw new ValidationException($result); } } - /** * Hook to validate this record against a validation result * * @param null|string $filename Optional filename to validate. If omitted, the current value is validated. */ - public function validate(ValidationResult $result, ?string $filename = null): bool + public function validateFilename(ValidationResult $result, ?string $filename = null): bool { if (empty($filename)) { $filename = $this->getFilename(); @@ -494,7 +493,6 @@ public function setField(string $fieldName, mixed $value, bool $markChanged = tr return parent::setField($fieldName, $value, $markChanged); } - /** * Returns the size of the file type in an appropriate format. *