[Pkg-owncloud-commits] [owncloud] 29/70: 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

David Prévot taffit at moszumanska.debian.org
Thu Aug 21 17:40:02 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v6.0.5RC1
in repository owncloud.

commit 2aabe31cb5a2b7d578f4cec1e974fd101cc76bc3
Author: Thomas Müller <thomas.mueller at tmit.eu>
Date:   Fri Jul 11 16:51:59 2014 +0200

    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
---
 lib/private/installer.php | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/lib/private/installer.php b/lib/private/installer.php
index 9b49543..31da3f1 100644
--- a/lib/private/installer.php
+++ b/lib/private/installer.php
@@ -63,9 +63,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"));
 			}
@@ -79,13 +80,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)));
 		}
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list