Adding authors to works sometimes fails on "expected /type/author, found /type/redirect" and edits are lost
Problem
Some books (e.g. anthologies) have lots of authors. When I've added many authors to a work and try to save, the save sometimes fails on the error message "expected /type/author, found /type/redirect". All edits are lost, and the error message doesn't say which author caused the problem.
Reproducing the bug
I believe this might be reproduced by
- adding an author to a work (but not saving yet)
- merging this author with others
- and only then saving the work that the author was added to.
(Although it happens in other cases, too. This is merely what I think might be easiest to reproduce.)
- Expected behavior: Show me an error message that says "These edits couldn't be saved because there is a problem with author x, please try again" and do not send me back to a page that lost all my edits.
- Actual behavior: Edits are lost, no helpful error message.
Context
- Browser (Chrome, Safari, Firefox, etc): Firefox
- OS (Windows, Mac, etc): Linux (Ubuntu)
- Logged in (Y/N): yes
- Environment (prod, dev, local): prod
Breakdown
Minimal solution: Take me back to the edit page in such a way that my edits are not lost. Would be nice to have: Tell me which author is causing the problem.
Requirements Checklist
- [ ]
Related files
Stakeholders
Instructions for Contributors
- Please run these commands to ensure your repository is up to date before creating a new branch to work on this issue and each time after pushing code to Github, because the pre-commit bot may add commits to your PRs upstream.
This is a result of unresolved redirects. The same problem that causes some merges to fail.
Hi @jimchamp @seabelis, I'd like to work on this. Planning to implement the minimal solution (preserve edits + better error messages). Is that acceptable, or would you like redirect auto-resolution included too?