From: Roeland Jago Douma Date: Fri, 18 Dec 2015 12:42:59 +0000 (+0100) Subject: Removed deprecated OC_Helper::getSecureMimeType X-Git-Tag: v9.0beta1~455^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4f20e3bac0dec72ede10f947ee3d1125071d4564;p=nextcloud-server.git Removed deprecated OC_Helper::getSecureMimeType --- diff --git a/apps/dav/lib/connector/sabre/file.php b/apps/dav/lib/connector/sabre/file.php index c66f627c0a3..6a0a39d04e7 100644 --- a/apps/dav/lib/connector/sabre/file.php +++ b/apps/dav/lib/connector/sabre/file.php @@ -329,7 +329,7 @@ class File extends Node implements IFile { if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PROPFIND') { return $mimeType; } - return \OC_Helper::getSecureMimeType($mimeType); + return \OC::$server->getMimeTypeDetector()->getSecureMimeType($mimeType); } /** diff --git a/apps/files/download.php b/apps/files/download.php index b0628e394be..b058f0ebf5b 100644 --- a/apps/files/download.php +++ b/apps/files/download.php @@ -39,7 +39,7 @@ if(!\OC\Files\Filesystem::file_exists($filename)) { exit; } -$ftype=\OC_Helper::getSecureMimeType(\OC\Files\Filesystem::getMimeType( $filename )); +$ftype=\OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType( $filename )); header('Content-Type:'.$ftype); OCP\Response::setContentDispositionHeader(basename($filename), 'attachment'); diff --git a/apps/files_versions/download.php b/apps/files_versions/download.php index 22a218f472a..d3c38f3d4e1 100644 --- a/apps/files_versions/download.php +++ b/apps/files_versions/download.php @@ -35,7 +35,7 @@ $versionName = '/'.$uid.'/files_versions/'.$filename.'.v'.$revision; $view = new OC\Files\View('/'); -$ftype = \OC_Helper::getSecureMimeType($view->getMimeType('/'.$uid.'/files/'.$filename)); +$ftype = \OC::$server->getMimeTypeDetector()->getSecureMimeType($view->getMimeType('/'.$uid.'/files/'.$filename)); header('Content-Type:'.$ftype); OCP\Response::setContentDispositionHeader(basename($filename), 'attachment'); diff --git a/lib/private/helper.php b/lib/private/helper.php index c6223d2147a..29ecd85388f 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -346,17 +346,6 @@ class OC_Helper { return \OC::$server->getMimeTypeDetector()->detectPath($path); } - /** - * Get a secure mimetype that won't expose potential XSS. - * - * @param string $mimeType - * @return string - * @deprecated 8.2.0 Use \OC::$server->getMimeTypeDetector()->getSecureMimeType($mimeType) - */ - static function getSecureMimeType($mimeType) { - return \OC::$server->getMimeTypeDetector()->getSecureMimeType($mimeType); - } - /** * get the mimetype form a data string * diff --git a/tests/lib/helper.php b/tests/lib/helper.php index 9ad3af3d60c..576209df06b 100644 --- a/tests/lib/helper.php +++ b/tests/lib/helper.php @@ -71,18 +71,6 @@ class Test_Helper extends \Test\TestCase { ]; } - 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 testGetStringMimeType() { if (\OC_Util::runningOnWindows()) { $this->markTestSkipped('[Windows] Strings have mimetype application/octet-stream on Windows');