if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PROPFIND') {
return $mimeType;
}
- return \OC_Helper::getSecureMimeType($mimeType);
+ return \OC::$server->getMimeTypeDetector()->getSecureMimeType($mimeType);
}
/**
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');
$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');
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
*
];
}
- 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');