Skip to content

Commit

Permalink
IBX-7310: Fixed max file size value for Image Asset (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
ciastektk authored Dec 7, 2023
1 parent 601b5b4 commit 52a25b0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/lib/Form/Type/FieldType/ImageAssetFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,19 @@ public function configureOptions(OptionsResolver $resolver)

/**
* Returns max size of uploaded file in bytes.
*
* @return int
*/
private function getMaxFileSize(): int
private function getMaxFileSize(): float
{
$validatorConfiguration = $this->assetMapper
->getAssetFieldDefinition()
->getValidatorConfiguration();

$maxFileSize = $validatorConfiguration['FileSizeValidator']['maxFileSize'];
if ($maxFileSize > 0) {
return min($maxFileSize * 1024 * 1024, $this->maxUploadSize->get());
return (float)min($maxFileSize * 1024 * 1024, $this->maxUploadSize->get());
}

return $this->maxUploadSize->get();
return (float)$this->maxUploadSize->get();
}
}

Expand Down

0 comments on commit 52a25b0

Please sign in to comment.