diff options
Diffstat (limited to 'apps/files_external/lib/definitionparameter.php')
-rw-r--r-- | apps/files_external/lib/definitionparameter.php | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/apps/files_external/lib/definitionparameter.php b/apps/files_external/lib/definitionparameter.php index 4b560908b69..7f883e5fad1 100644 --- a/apps/files_external/lib/definitionparameter.php +++ b/apps/files_external/lib/definitionparameter.php @@ -154,22 +154,31 @@ class DefinitionParameter implements \JsonSerializable { /** * Validate a parameter value against this + * Convert type as necessary * * @param mixed $value Value to check * @return bool success */ - public function validateValue($value) { - if ($this->getFlags() & self::FLAG_OPTIONAL) { - return true; - } + public function validateValue(&$value) { + $optional = $this->getFlags() & self::FLAG_OPTIONAL; + switch ($this->getType()) { case self::VALUE_BOOLEAN: if (!is_bool($value)) { - return false; + switch ($value) { + case 'true': + $value = true; + break; + case 'false': + $value = false; + break; + default: + return false; + } } break; default: - if (empty($value)) { + if (!$value && !$optional) { return false; } break; |