Fix elementToFile to also return path when defined

Fixes issue when opening the share dialog for a file inside the favorite
list, and the file is from a subfolder
This commit is contained in:
Vincent Petry 2016-02-08 17:02:05 +01:00
parent 850ac0cf84
commit ae367c7e97
2 changed files with 10 additions and 0 deletions

View File

@ -815,6 +815,10 @@
if (mountType) {
data.mountType = mountType;
}
var path = $el.attr('data-path');
if (path) {
data.path = path;
}
return data;
},

View File

@ -2521,6 +2521,12 @@ describe('OCA.Files.FileList tests', function() {
expect(fileInfo.size).toEqual(12);
expect(fileInfo.mimetype).toEqual('text/plain');
expect(fileInfo.type).toEqual('file');
expect(fileInfo.path).not.toBeDefined();
});
it('adds path attribute if available', function() {
$tr.attr('data-path', '/subdir');
var fileInfo = fileList.elementToFile($tr);
expect(fileInfo.path).toEqual('/subdir');
});
});
describe('new file menu', function() {