diff options
author | Thomas Mueller <thomas.mueller@tmit.eu> | 2012-11-16 11:50:57 +0100 |
---|---|---|
committer | Thomas Mueller <thomas.mueller@tmit.eu> | 2012-11-16 11:50:57 +0100 |
commit | 2b192a75c41c1ef1d02677cd08f5781a54391509 (patch) | |
tree | 524f54d933bb6ca7bbd82d7601b2c8a508318f90 /apps/files/ajax/upload.php | |
parent | 7af4cf48c9c542326626d742282aa1958b4b3501 (diff) | |
download | nextcloud-server-2b192a75c41c1ef1d02677cd08f5781a54391509.tar.gz nextcloud-server-2b192a75c41c1ef1d02677cd08f5781a54391509.zip |
normalize the path once in upload.php is enough - THX Robin for this hint
Diffstat (limited to 'apps/files/ajax/upload.php')
-rw-r--r-- | apps/files/ajax/upload.php | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index 92871059936..c3d3199a003 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -48,15 +48,11 @@ if(strpos($dir, '..') === false) { $fileCount=count($files['name']); for($i=0;$i<$fileCount;$i++) { $target = OCP\Files::buildNotExistingFileName(stripslashes($dir), $files['name'][$i]); + // $path needs to be normalized - this failed within drag'n'drop upload to a sub-folder + $target = OC_Filesystem::normalizePath($target); 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); - // in case the upload goes to a sub directory getID() returns -1 and $target needs to be normalized - // calling normalizePath() inside getId() causes endless scan. - if ($id == -1) { - $path = OC_Filesystem::normalizePath($target); - $id = OC_FileCache::getId($path); - } $result[]=array( "status" => "success", 'mime'=>$meta['mimetype'], 'size'=>$meta['size'], 'id'=>$id, 'name'=>basename($target)); } } |