Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/files/js/fileactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@
a: null
},
function(event) {
context.fileList._setCurrentRow(context.$file);
event.stopPropagation();
event.preventDefault();

Expand Down
34 changes: 31 additions & 3 deletions apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@
*/
initialized: false,

/**
* Last clicked row
*/
$currentRow: null,

/**
* Number of files per page
*
Expand Down Expand Up @@ -396,7 +401,6 @@
this.$el.off('urlChanged.filelistbound');
// remove events attached to the $container
this.$container.off('scroll.' + this.$el.attr('id'));

},

/**
Expand Down Expand Up @@ -453,7 +457,12 @@
}

// if requesting the selected model, return it
if (this._currentFileModel && this._currentFileModel.get('name') === fileName) {
// also take the file id into account if possible because
// the file name may not be unique
if (this._currentFileModel &&
this._currentFileModel.get('name') === fileName &&
(!this.$currentRow || this.$currentRow.data('id') === this._currentFileModel.id)
) {
return this._currentFileModel;
}

Expand Down Expand Up @@ -630,6 +639,8 @@
* Event handler for when clicking on files to select them
*/
_onClickFile: function(event) {
this._setCurrentRow($(event.currentTarget).closest('tr'));

var $link = $(event.target).closest('a');
if ($link.attr('href') === '#' || $link.hasClass('disable-click')) {
event.preventDefault();
Expand Down Expand Up @@ -930,7 +941,15 @@
*/
findFileEl: function(fileName){
// use filterAttr to avoid escaping issues
return this.$fileList.find('tr').filterAttr('data-file', fileName);
var $fileEl = this.$fileList.find('tr').filterAttr('data-file', fileName);

// take the file id into account if possible because the file name
// may not be unique which results in multiple elements
if (this.$currentRow && $fileEl.length > 1) {
$fileEl = $fileEl.filter('[data-id="' + this.$currentRow.data('id') + '"]');
}

return $fileEl;
},

/**
Expand Down Expand Up @@ -1566,6 +1585,15 @@
}
this.breadcrumb.setDirectory(this.getCurrentDirectory());
},

/**
* Sets the currently clicked row
* We use this event to give the findFileEl a unique identifier.
*/
_setCurrentRow: function($rowEl) {
this.$currentRow = $rowEl;
},

/**
* Sets the current sorting and refreshes the list
*
Expand Down
8 changes: 8 additions & 0 deletions changelog/unreleased/38415
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Bugfix: Fix issues with duplicated file names in the same directory

In some views like the "Shared by link"-list it is possible to have
one or more files with the same name in one directory. This fix corrects
plenty of wrong behaviors that such a scenario caused in the UI.

https://github.com/owncloud/core/pull/38415
https://github.com/owncloud/enterprise/issues/4412
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Feature: Share by public link
And the public accesses the last created public link using the webUI
Then the content of the file shared by the last public link should be the same as "lorem.txt"

@skipOnOcV10 @issue-35177
@skipOnOcV10.5 @skipOnOcV10.6
Scenario: User renames a subfolder among subfolders with same names which are shared by public links
Given user "Alice" has created folder "nf1"
And user "Alice" has created folder "nf1/newfolder"
Expand Down

This file was deleted.