summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-11-02 17:36:13 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-11-02 17:36:13 +0100
commit620dc7ce2268835ac578c89a71f317a39e27424a (patch)
tree6ef301ce35a131278ad951247d0c420884316305 /lib
parent44f4de1526640b195b543805c5052ef62987d81c (diff)
parent40ae54d60ae56eddab28a67ebab504128ebb3ec4 (diff)
downloadnextcloud-server-620dc7ce2268835ac578c89a71f317a39e27424a.tar.gz
nextcloud-server-620dc7ce2268835ac578c89a71f317a39e27424a.zip
Merge pull request #20196 from owncloud/use-actual-mimetype-detection-instead-of-oath
Use actual mimetype detection instead of extension
Diffstat (limited to 'lib')
-rw-r--r--lib/private/archive.php18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/private/archive.php b/lib/private/archive.php
index 191d45296c7..54c5a71f715 100644
--- a/lib/private/archive.php
+++ b/lib/private/archive.php
@@ -31,20 +31,20 @@
abstract class OC_Archive{
/**
- * open any of the supported archive types
+ * Open any of the supported archive types
+ *
* @param string $path
* @return OC_Archive|void
*/
public static function open($path) {
- $ext=substr($path, strrpos($path, '.'));
- switch($ext) {
- case '.zip':
+ $mime = \OC::$server->getMimeTypeDetector()->detect($path);
+
+ switch($mime) {
+ case 'application/zip':
return new OC_Archive_ZIP($path);
- case '.gz':
- case '.bz':
- case '.bz2':
- case '.tgz':
- case '.tar':
+ case 'application/x-gzip':
+ return new OC_Archive_TAR($path);
+ case 'application/x-bzip2':
return new OC_Archive_TAR($path);
}
}