mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #5444 from tractorcow/pulls/3/fix-upload-size
BUG fix Upload_Validator getAllowedMaxFilesize
This commit is contained in:
commit
36e64168a5
@ -416,11 +416,9 @@ class Upload_Validator {
|
||||
if ($category && isset($this->allowedMaxFileSize['[' . $category . ']'])) {
|
||||
return $this->allowedMaxFileSize['[' . $category . ']'];
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return (isset($this->allowedMaxFileSize['*'])) ? $this->allowedMaxFileSize['*'] : false;
|
||||
}
|
||||
|
||||
return (isset($this->allowedMaxFileSize['*'])) ? $this->allowedMaxFileSize['*'] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -176,6 +176,13 @@ class UploadTest extends SapphireTest {
|
||||
|
||||
$retrievedSize = $v->getAllowedMaxFileSize('txt');
|
||||
$this->assertEquals(4096, $retrievedSize, 'Max file size check on instance values failed (instance extension set check)');
|
||||
|
||||
// Check a wildcard max file size against a file with an extension
|
||||
$v = new UploadTest_Validator();
|
||||
$v->setAllowedMaxFileSize(2000);
|
||||
|
||||
$retrievedSize = $v->getAllowedMaxFileSize('.jpg');
|
||||
$this->assertEquals(2000, $retrievedSize, 'Max file size check on instance values failed (wildcard max file size)');
|
||||
|
||||
Config::unnest();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user