diff options
Diffstat (limited to 'apps/files/ajax/upload.php')
-rw-r--r-- | apps/files/ajax/upload.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index 4ed0bbc5b0f..92871059936 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -51,6 +51,12 @@ if(strpos($dir, '..') === false) { 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)); } } |