From 51e47319ef2ab37d458dc96ba33a26bb851102be Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Mon, 14 Apr 2014 17:17:50 +0200 Subject: White-list known secure mime types. Refs. #8184 --- tests/lib/helper.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/lib') 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')); -- cgit v1.2.3