summaryrefslogtreecommitdiff
path: root/modules/simpletest
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2014-11-03 10:11:56 -0500
committerDavid Rothstein <drothstein@gmail.com>2014-11-03 10:11:56 -0500
commitc401ec33e847ec2710ef6914625ca63a3e5663b4 (patch)
treed8d4a4c29f05163ec6b94283199731ed4f39ca43 /modules/simpletest
parent0b4c3b17e2209b1804a7b6b5974e5217c3e2a87e (diff)
downloadbrdo-c401ec33e847ec2710ef6914625ca63a3e5663b4.tar.gz
brdo-c401ec33e847ec2710ef6914625ca63a3e5663b4.tar.bz2
Issue #2112247 by sihv, mitsuroseba, dgroene, aalamaki, Dennis Walgaard, mErilainen: Fixed Valid file extensions in file names are not properly enforced when uploading files with non-lowercase names.
Diffstat (limited to 'modules/simpletest')
-rw-r--r--modules/simpletest/tests/file.test11
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/simpletest/tests/file.test b/modules/simpletest/tests/file.test
index 0e66775a9..b75327f11 100644
--- a/modules/simpletest/tests/file.test
+++ b/modules/simpletest/tests/file.test
@@ -2556,6 +2556,7 @@ class FileNameMungingTest extends FileTestCase {
parent::setUp();
$this->bad_extension = 'php';
$this->name = $this->randomName() . '.' . $this->bad_extension . '.txt';
+ $this->name_with_uc_ext = $this->randomName() . '.' . strtoupper($this->bad_extension) . '.txt';
}
/**
@@ -2593,9 +2594,13 @@ class FileNameMungingTest extends FileTestCase {
* White listed extensions are ignored by file_munge_filename().
*/
function testMungeIgnoreWhitelisted() {
- // Declare our extension as whitelisted.
- $munged_name = file_munge_filename($this->name, $this->bad_extension);
- $this->assertIdentical($munged_name, $this->name, format_string('The new filename (%munged) matches the original (%original) once the extension has been whitelisted.', array('%munged' => $munged_name, '%original' => $this->name)));
+ // Declare our extension as whitelisted. The declared extensions should
+ // be case insensitive so test using one with a different case.
+ $munged_name = file_munge_filename($this->name_with_uc_ext, $this->bad_extension);
+ $this->assertIdentical($munged_name, $this->name_with_uc_ext, format_string('The new filename (%munged) matches the original (%original) once the extension has been whitelisted.', array('%munged' => $munged_name, '%original' => $this->name_with_uc_ext)));
+ // The allowed extensions should also be normalized.
+ $munged_name = file_munge_filename($this->name, strtoupper($this->bad_extension));
+ $this->assertIdentical($munged_name, $this->name, format_string('The new filename (%munged) matches the original (%original) also when the whitelisted extension is in uppercase.', array('%munged' => $munged_name, '%original' => $this->name)));
}
/**