summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2014-04-14 17:17:50 +0200
committerThomas Tanghus <thomas@tanghus.net>2014-04-14 17:17:50 +0200
commit51e47319ef2ab37d458dc96ba33a26bb851102be (patch)
treeb23ba6f4a4359a21db51dd9ae36d0def39c07209 /tests
parent71de32186936c4afc2e48a566c2d3c6f3fdf365b (diff)
downloadnextcloud-server-51e47319ef2ab37d458dc96ba33a26bb851102be.tar.gz
nextcloud-server-51e47319ef2ab37d458dc96ba33a26bb851102be.zip
White-list known secure mime types. Refs. #8184
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/helper.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/lib/helper.php b/tests/lib/helper.php
index 0943e6bc1b9..5d319e40f02 100644
--- a/tests/lib/helper.php
+++ b/tests/lib/helper.php
@@ -71,6 +71,18 @@ class Test_Helper extends PHPUnit_Framework_TestCase {
$this->assertEquals($result, $expected);
}
+ function testGetSecureMimeType() {
+ $dir=OC::$SERVERROOT.'/tests/data';
+
+ $result = OC_Helper::getSecureMimeType('image/svg+xml');
+ $expected = 'text/plain';
+ $this->assertEquals($result, $expected);
+
+ $result = OC_Helper::getSecureMimeType('image/png');
+ $expected = 'image/png';
+ $this->assertEquals($result, $expected);
+ }
+
function testGetFileNameMimeType() {
$this->assertEquals('text/plain', OC_Helper::getFileNameMimeType('foo.txt'));
$this->assertEquals('image/png', OC_Helper::getFileNameMimeType('foo.png'));