From 3da1339cd84a386064a74f0d1c8c22a7b207bf6c Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind@owncloud.com>
Date: Sun, 19 Aug 2012 05:04:58 +0200
Subject: [PATCH] fix error when adding string data to an archive

---
 lib/archive/tar.php | 2 +-
 lib/archive/zip.php | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/archive/tar.php b/lib/archive/tar.php
index 944a0ac4ba..c8b3d5e626 100644
--- a/lib/archive/tar.php
+++ b/lib/archive/tar.php
@@ -79,7 +79,7 @@ class OC_Archive_TAR extends OC_Archive{
 		if($this->fileExists($path)){
 			$this->remove($path);
 		}
-		if(file_exists($source)){
+		if($source and $source[0]=='/' and file_exists($source)){
 			$header=array();
 			$dummy='';
 			$this->tar->_openAppend();
diff --git a/lib/archive/zip.php b/lib/archive/zip.php
index b2d6674d63..c1a5c35738 100644
--- a/lib/archive/zip.php
+++ b/lib/archive/zip.php
@@ -36,7 +36,7 @@ class OC_Archive_ZIP extends OC_Archive{
 	 * @return bool
 	 */
 	function addFile($path,$source=''){
-		if(file_exists($source)){
+		if($source and $source[0]=='/' and file_exists($source)){
 			$result=$this->zip->addFile($source,$path);
 		}else{
 			$result=$this->zip->addFromString($path,$source);
-- 
GitLab