]> source.dussan.org Git - nextcloud-server.git/commitdiff
Removed deprecated OC_Helper::getSecureMimeType
authorRoeland Jago Douma <rullzer@owncloud.com>
Fri, 18 Dec 2015 12:42:59 +0000 (13:42 +0100)
committerRoeland Jago Douma <rullzer@owncloud.com>
Fri, 18 Dec 2015 12:42:59 +0000 (13:42 +0100)
apps/dav/lib/connector/sabre/file.php
apps/files/download.php
apps/files_versions/download.php
lib/private/helper.php
tests/lib/helper.php

index c66f627c0a371eacefa4e50a868721ac6a692a24..6a0a39d04e7af9dd81e098f2c8087c3fc6eb7250 100644 (file)
@@ -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);
        }
 
        /**
index b0628e394be5705f609c80648f5b2b99ead66dcf..b058f0ebf5b72f0c918f1d67aa37508337e2de37 100644 (file)
@@ -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');
index 22a218f472aac51dd6d81cd063ab1a3d5ecacece..d3c38f3d4e109291fa09e1f3317c31d4489511a3 100644 (file)
@@ -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');
index c6223d2147aea847bd22791330af65746950cb12..29ecd85388f60379084fe011bf686aa3fdcf1308 100644 (file)
@@ -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
         *
index 9ad3af3d60c4baa16144fcafd890b89af6c43248..576209df06bb8fb6ab830d2d0cc7d8c6e51efbc3 100644 (file)
@@ -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');