internetarchive / internetarchive/openlibrary
Adding authors to works sometimes fails on "expected /type/author, found /type/redirect" and edits are lost
- Dominant language
- Python
- Stars
- 6.7k
- Forks
- 2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 138
Description
### 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
1. adding an author to a work (but not saving yet)
2. merging this author with others
3. 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](https://github.com/internetarchive/openlibrary/wiki/Git-Cheat-Sheet#working-on-your-branch) to ensure your repository is up to date **before** [creating a new branch](https://github.com/internetarchive/openlibrary/wiki/Git-Cheat-Sheet#making-changes-and-creating-a-pull-request) 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.
Contributor guide
Assessment
This issue has not been assessed yet.