Skip to content

Commit

Permalink
FIX incorrect calculation of MAX_FILE_SIZE (#600)
Browse files Browse the repository at this point in the history
* Fixes incorrect calculation of MAX_FILE_SIZE

* Fixes expected bytes in EditableFileFiled test
  • Loading branch information
zanderwar authored and robbieaverill committed May 24, 2017
1 parent 5777b33 commit e86306c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion code/model/editableformfields/EditableFileField.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function getFormField()
);

if ($this->MaxFileSizeMB > 0) {
$field->getValidator()->setAllowedMaxFileSize($this->MaxFileSizeMB * 1024);
$field->getValidator()->setAllowedMaxFileSize($this->MaxFileSizeMB * 1024 * 1024);
} else {
$field->getValidator()->setAllowedMaxFileSize(static::get_php_max_file_size());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/EditableFileFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function testUpdatedMaxFileSize()
$fileField->write();

$formField = $fileField->getFormField();
$this->assertEquals($formField->getValidator()->getAllowedMaxFileSize(), 256);
$this->assertEquals($formField->getValidator()->getAllowedMaxFileSize(), 262144);
}

}

0 comments on commit e86306c

Please sign in to comment.