Return path attribute for ajax rename operations

This fixes an issue when renaming files from a flat list view like
"Favorites" or "Shared with you", in which case the path needs to be
present in the response to make sure the data-path attribute is properly
set in the JS side.
This commit is contained in:
Vincent Petry 2015-01-12 14:01:40 +01:00
parent dac7828480
commit 8cc13031e9
2 changed files with 3 additions and 0 deletions

View File

@ -106,6 +106,7 @@ class App {
$meta = $this->view->getFileInfo($normalizedNewPath);
$meta = \OCA\Files\Helper::populateTags(array($meta));
$fileInfo = \OCA\Files\Helper::formatFileInfo(current($meta));
$fileInfo['path'] = dirname($normalizedNewPath);
$result['success'] = true;
$result['data'] = $fileInfo;
} else {

View File

@ -118,6 +118,7 @@ class Test_OC_Files_App_Rename extends \Test\TestCase {
$this->assertEquals('httpd/unix-directory', $result['data']['mimetype']);
$this->assertEquals('abcdef', $result['data']['etag']);
$this->assertFalse(isset($result['data']['tags']));
$this->assertEquals('/', $result['data']['path']);
$icon = \OC_Helper::mimetypeIcon('dir');
$icon = substr($icon, 0, -3) . 'svg';
$this->assertEquals($icon, $result['data']['icon']);
@ -182,6 +183,7 @@ class Test_OC_Files_App_Rename extends \Test\TestCase {
$this->assertEquals('text/plain', $result['data']['mimetype']);
$this->assertEquals('abcdef', $result['data']['etag']);
$this->assertEquals(array('tag1', 'tag2'), $result['data']['tags']);
$this->assertEquals('/', $result['data']['path']);
$icon = \OC_Helper::mimetypeIcon('text');
$icon = substr($icon, 0, -3) . 'svg';
$this->assertEquals($icon, $result['data']['icon']);