Skip to content

Fix misleading "already requested" error on in-progress downloads - #291

Open
zpersichetti wants to merge 2 commits into
kikootwo:mainfrom
zpersichetti:fix/user-section-download-duplicate-request
Open

Fix misleading "already requested" error on in-progress downloads#291
zpersichetti wants to merge 2 commits into
kikootwo:mainfrom
zpersichetti:fix/user-section-download-duplicate-request

Conversation

@zpersichetti

Copy link
Copy Markdown

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:

  • downloading / processing -> BeingProcessed
  • awaiting_approval -> AwaitingApproval

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.

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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant