From 808d6c58fe3e7ff1d33af3cc84fc67834b4916e0 Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind@owncloud.com>
Date: Sun, 19 Aug 2012 05:45:55 +0200
Subject: [PATCH] ensure proper result format when using opendir on the archive
 storage backend

---
 apps/files_archive/lib/storage.php | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/apps/files_archive/lib/storage.php b/apps/files_archive/lib/storage.php
index add00ed8d8..a3271dc390 100644
--- a/apps/files_archive/lib/storage.php
+++ b/apps/files_archive/lib/storage.php
@@ -39,11 +39,18 @@ class OC_Filestorage_Archive extends OC_Filestorage_Common{
 	}
 	public function opendir($path){
 		$path=$this->stripPath($path);
-		$content=$this->archive->getFolder($path);
-		foreach($content as &$file){
+		if(substr($path,-1)!=='/'){
+			$path.='/';
+		}
+		$files=$this->archive->getFolder($path);
+		$content=array();
+		foreach($files as $file){
 			if(substr($file,-1)=='/'){
 				$file=substr($file,0,-1);
 			}
+			if($file and strpos($file,'/')===false){
+				$content[]=$file;
+			}
 		}
 		$id=md5($this->path.$path);
 		OC_FakeDirStream::$dirs[$id]=$content;
-- 
GitLab