[Pkg-owncloud-commits] [owncloud] 94/394: get the right metadata and file id if a file was uploaded to a Shared folder

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:11:35 UTC 2013


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

taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.

commit cb55229c1e1321dd806ce376adb1a46d540f034a
Author: Björn Schießle <schiessle at owncloud.com>
Date:   Wed Nov 14 14:55:22 2012 +0100

    get the right metadata and file id if a file was uploaded to a Shared folder
---
 apps/files/ajax/upload.php |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php
index a4dcd80..3a3d874 100644
--- a/apps/files/ajax/upload.php
+++ b/apps/files/ajax/upload.php
@@ -49,8 +49,19 @@ if(strpos($dir, '..') === false) {
 	for($i=0;$i<$fileCount;$i++) {
         $target = OCP\Files::buildNotExistingFileName(stripslashes($dir), $files['name'][$i]);
 		if(is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i], $target)) {
-			$meta = OC_FileCache::get($target);
-			$id = OC_FileCache::getId($target);
+			if ( OC_App::isEnabled('files_sharing') &&  !strncmp($target, '/Shared/', 8)) {
+				$source = OC_Files_Sharing_Util::getSourcePath(str_replace('/Shared/', '', $target));
+				$parts = explode('/', $source, 4);
+				$root =  '/'.$parts[1].'/files';
+				$path = '/'.$parts[3];
+			} else {
+				$path = $target;
+				$root = false;
+			}
+				
+			$meta = OC_FileCache::get($path, $root);
+			$id = OC_FileCache::getId($path, $root);
+
 			$result[]=array( "status" => "success", 'mime'=>$meta['mimetype'],'size'=>$meta['size'], 'id'=>$id, 'name'=>basename($target));
 		}
 	}

-- 
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