diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-02-08 17:02:05 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-02-08 22:33:39 +0100 |
commit | ae367c7e97b99885c7cb1feadae22aa1bb6cb729 (patch) | |
tree | 23b9b4361c1e0b399f49f67ce108acd313c6f27f | |
parent | 850ac0cf84f2492b16204b811f58a0dc7dc43b6e (diff) | |
download | nextcloud-server-ae367c7e97b99885c7cb1feadae22aa1bb6cb729.tar.gz nextcloud-server-ae367c7e97b99885c7cb1feadae22aa1bb6cb729.zip |
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
-rw-r--r-- | apps/files/js/filelist.js | 4 | ||||
-rw-r--r-- | apps/files/tests/js/filelistSpec.js | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 35999b5d0ee..1a6f38d3d7c 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -815,6 +815,10 @@ if (mountType) { data.mountType = mountType; } + var path = $el.attr('data-path'); + if (path) { + data.path = path; + } return data; }, diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js index 1b2dd12213b..0091a9ee6e4 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -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() { |