Fix misleading "already requested" error on in-progress downloads - #291
Open
zpersichetti wants to merge 2 commits into
Open
Fix misleading "already requested" error on in-progress downloads#291zpersichetti wants to merge 2 commits into
zpersichetti wants to merge 2 commits into
Conversation
The request-with-torrent duplicate check only whitelisted failed/warn/cancelled for re-request, so a book with an in-flight request (downloading/processing) or one awaiting approval fell through to the misleading 'You have already requested this audiobook' message. Extend the first check to also catch downloading/processing/awaiting_approval and return status-appropriate errors (BeingProcessed / AwaitingApproval).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In the user (non-admin) section, clicking "Download" on an audiobook that already
has a request in an in-progress state (downloading / processing) — or one awaiting
admin approval — returns the misleading "You have already requested this audiobook"
error. The same action works in the admin section because it routes through
select-torrent on the existing request.
Root cause
request-with-torrent's first check only matched completed statuses
(downloaded / available). Requests in downloading / processing / awaiting_approval
fell through to the later duplicate-request check, whose re-request whitelist is
only ['failed', 'warn', 'cancelled'], producing the generic "already requested"
message.
Fix
Extend the first check to also catch downloading, processing, and
awaiting_approval, returning status-appropriate errors:
The frontend already handles BeingProcessed and surfaces data.message for other
error codes, so no frontend change is needed.
Testing
npm ci && tsc --noEmit passes cleanly.