summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-06-23 15:36:14 +0200
committerGitHub <noreply@github.com>2016-06-23 15:36:14 +0200
commitcc2aec11af4df1cdc98f12036e59d7fbace19265 (patch)
treee872bf0e5f604afe236089aea5757beca0ab664c
parent1e1903e4feffb98bde50cf41618d6bb3ef11c88a (diff)
parent508c580e67e8cdec45cd72bc7c34e60890e6576e (diff)
downloadnextcloud-server-cc2aec11af4df1cdc98f12036e59d7fbace19265.tar.gz
nextcloud-server-cc2aec11af4df1cdc98f12036e59d7fbace19265.zip
Merge pull request #25238 from owncloud/files-trashlistnamecorruption
Fix trashed file name corruption when rerendering trashbin list
-rw-r--r--apps/files_trashbin/js/filelist.js2
-rw-r--r--apps/files_trashbin/tests/js/filelistSpec.js22
2 files changed, 24 insertions, 0 deletions
diff --git a/apps/files_trashbin/js/filelist.js b/apps/files_trashbin/js/filelist.js
index feed28d8fc7..510ab2c21bc 100644
--- a/apps/files_trashbin/js/filelist.js
+++ b/apps/files_trashbin/js/filelist.js
@@ -93,6 +93,8 @@
_renderRow: function(fileData, options) {
options = options || {};
+ // make a copy to avoid changing original object
+ fileData = _.extend({}, fileData);
var dir = this.getCurrentDirectory();
var dirListing = dir !== '' && dir !== '/';
// show deleted time as mtime
diff --git a/apps/files_trashbin/tests/js/filelistSpec.js b/apps/files_trashbin/tests/js/filelistSpec.js
index 05caaf27865..5e9a4cf27d1 100644
--- a/apps/files_trashbin/tests/js/filelistSpec.js
+++ b/apps/files_trashbin/tests/js/filelistSpec.js
@@ -163,6 +163,28 @@ describe('OCA.Trashbin.FileList tests', function() {
expect(fileList.findFileEl('One.txt.d11111')[0]).toEqual($tr[0]);
});
+ it('renders rows with the correct data when in root after calling setFiles with the same data set', function() {
+ // dir listing is false when in root
+ $('#dir').val('/');
+ fileList.setFiles(testFiles);
+ fileList.setFiles(fileList.files);
+ var $rows = fileList.$el.find('tbody tr');
+ var $tr = $rows.eq(0);
+ expect($rows.length).toEqual(4);
+ expect($tr.attr('data-id')).toEqual('1');
+ expect($tr.attr('data-type')).toEqual('file');
+ expect($tr.attr('data-file')).toEqual('One.txt.d11111');
+ expect($tr.attr('data-size')).not.toBeDefined();
+ expect($tr.attr('data-etag')).toEqual('abc');
+ expect($tr.attr('data-permissions')).toEqual('9'); // read and delete
+ expect($tr.attr('data-mime')).toEqual('text/plain');
+ expect($tr.attr('data-mtime')).toEqual('11111000');
+ expect($tr.find('a.name').attr('href')).toEqual('#');
+
+ expect($tr.find('.nametext').text().trim()).toEqual('One.txt');
+
+ expect(fileList.findFileEl('One.txt.d11111')[0]).toEqual($tr[0]);
+ });
it('renders rows with the correct data when in subdirectory', function() {
// dir listing is true when in a subdir
$('#dir').val('/subdir');