Merge pull request #9598 from owncloud/fix-app-installation-master

append file extension to the temporary file which contains the downloade...
This commit is contained in:
Thomas Müller 2014-07-14 17:05:36 +02:00
commit 4b91741875
1 changed files with 4 additions and 9 deletions

View File

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