server icon indicating copy to clipboard operation
server copied to clipboard

fix: Return a file element even if the rendered list does not contained one

Open juliushaertl opened this issue 2 months ago • 0 comments

Proper fix replacing https://github.com/nextcloud/server/pull/45031

When creating a file from a template we trigger a file action. This has a dependency on the file element $el that is used by some apps in <27 to get certain file attributes. Now while we wait for the file to be added to the file list, it might not be rendered if it is added at the end of the list outside the visible view.

This PR addresses it by adding a fallback to return the rendered row in case we could not find the element in the DOM.

Onlyoffice is one example using this https://github.com/ONLYOFFICE/onlyoffice-nextcloud/blob/master/src/main.js#L212 but there are potentially others out there as well.

Steps to reproduce:

  • Setup onlyoffice
  • Have a directory that has lots of files
  • Create a new file Called "Z.docx" so it is put at the very end of the file list from a template

Error before the change

Screenshot 2024-04-30 at 14 32 47

juliushaertl avatar Apr 30 '24 12:04 juliushaertl