Retrying a failed wiki attachment upload doesn't work

Summary

When uploading a wiki attachment fails, we display an error message and a "Try again" link. Clicking that link results in a JS error.

Steps to reproduce

  1. Edit a wiki page.
  2. Trigger a failed upload somehow. Currently, selecting multiple files will frequently result in an error until #197927 (closed) is fixed.
  3. Click the "Try again" link.

What is the current bug behavior?

The link doesn't do anything, and the browser console shows a JS error TypeError: e.target.closest(...) is null.

What is the expected correct behavior?

The failed files should be retried and inserted into the document.

Relevant logs and/or screenshots

Output of checks

This bug happens on GitLab.com

Possible fixes

  • Not sure if we have the same problem on issues/comments/etc., as I don't know how to reproduce a failed upload there. They use normal file storage for attachments rather than a Git repository like wikis, so they don't suffer from #197927 (closed).
  • The error might only happen in the wiki editor due to differences in the DOM.
  • If it turns out to be too complicated to support retrying, we could also remove the "Try again" link on the wiki editor.
  • The error message returned from Gitaly also says "Please refresh and try again", if we can get the "Try again" link to work correctly we should remove that part of the error.