Commit 4f20e3ba authored by Roeland Jago Douma's avatar Roeland Jago Douma
Browse files

Removed deprecated OC_Helper::getSecureMimeType

parent b4a896c0
......@@ -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);
}
/**
......
......@@ -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');
......
......@@ -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');
......
......@@ -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
*
......
......@@ -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');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment