diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-07-11 16:51:59 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-07-11 16:51:59 +0200 |
commit | e47cd5ebf1658ef65361f3a3986925899ef8baf6 (patch) | |
tree | 697532f57aea6baf77a02ef333b00233a2b21a0e /lib/private/installer.php | |
parent | 8dc3c3ed6af4afb4ddd6e196b97cafcf3245d377 (diff) | |
download | nextcloud-server-e47cd5ebf1658ef65361f3a3986925899ef8baf6.tar.gz nextcloud-server-e47cd5ebf1658ef65361f3a3986925899ef8baf6.zip |
append file extension to the temporary file which contains the downloaded archive - in case of zip files fileinfo doesn't seem to return anything reliable
Diffstat (limited to 'lib/private/installer.php')
-rw-r--r-- | lib/private/installer.php | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/private/installer.php b/lib/private/installer.php index 29470dbe3a6..f1c99f1e2b6 100644 --- a/lib/private/installer.php +++ b/lib/private/installer.php @@ -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))); } |