]> source.dussan.org Git - nextcloud-server.git/commitdiff
append file extension to the temporary file which contains the downloaded archive...
authorThomas Müller <thomas.mueller@tmit.eu>
Fri, 11 Jul 2014 14:51:59 +0000 (16:51 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Fri, 11 Jul 2014 14:51:59 +0000 (16:51 +0200)
lib/private/installer.php

index 29470dbe3a6ba2d4a98e45021132a6ce72a475d0..f1c99f1e2b69f3824b831bf490029314eb0f35ff 100644 (file)
@@ -235,9 +235,10 @@ class OC_Installer{
                        throw new \Exception($l->t("No source specified when installing app"));
                }
 
-               //download the file if necesary
+               //download the file if necessary
                if($data['source']=='http') {
-                       $path=OC_Helper::tmpFile();
+                       $pathInfo = pathinfo($data['href']);
+                       $path=OC_Helper::tmpFile('.' . $pathInfo['extension']);
                        if(!isset($data['href'])) {
                                throw new \Exception($l->t("No href specified when installing app from http"));
                        }
@@ -251,13 +252,7 @@ class OC_Installer{
 
                //detect the archive type
                $mime=OC_Helper::getMimeType($path);
-               if($mime=='application/zip') {
-                       rename($path, $path.'.zip');
-                       $path.='.zip';
-               }elseif($mime=='application/x-gzip') {
-                       rename($path, $path.'.tgz');
-                       $path.='.tgz';
-               }else{
+               if ($mime !=='application/zip' && $mime !== 'application/x-gzip') {
                        throw new \Exception($l->t("Archives of type %s are not supported", array($mime)));
                }