Skip to content

Commit

Permalink
fix: Return a file element even if the rendered list does not contain…
Browse files Browse the repository at this point in the history
…ed one

Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliushaertl committed Apr 30, 2024
1 parent 6a045e3 commit d59567d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -1357,8 +1357,18 @@
* @return {Object} jQuery object of the matching row
*/
findFileEl: function(fileName){
// use filterAttr to avoid escaping issues
return this.$fileList.find('tr').filterAttr('data-file', fileName);
var fileRow = this.$fileList.find('tr').filterAttr('data-file', fileName);
if (fileRow.length) {
return fileRow;
}

// The row we try to get might not have been rendered due to pagination,
// so in case we find the file in the file list return the rendered row instead
var fileData = this.files.find(function (el){
return el.name === fileName;
});

return fileData ? this._renderRow(fileData, {updateSummary: false, silent: true}) : fileRow;
},

/**
Expand Down

0 comments on commit d59567d

Please sign in to comment.