Skip to content

fix(downloads): validate sources and stabilize url entry - #2154

Merged
agalwood merged 2 commits into
mainfrom
fix/2151_url_admission_20260917
Sep 17, 2026
Merged

agalwood merged 2 commits into
mainfrom
fix/2151_url_admission_20260917

Conversation

@agalwood

Copy link
Copy Markdown
Owner

Summary / 概述

A completed plugin hook could leave a deadline armed and cancel a later invocation. Ambiguous URL input could also be rewritten by different parsers before reaching the engine. This PR scopes cancellation to each invocation and applies a shared source-admission policy before task-creation side effects.

Add Task now shows precise inline diagnostics, with a red icon at the end of each invalid URL's last visual row and a hover tooltip. Corrections are explicit and reversible; valid lines can be submitted while invalid or unconfirmed lines remain editable.

Related issue / 相关 Issue

Refs #2151.

Companion scraper change: motrixapp/builtin-plugins#3. It has its own release lifecycle; this PR does not update the signed builtins lock.

Changes / 改动

  • Dispose completed hook deadlines and bind cancellation to the captured invocation.
  • Validate local/server requests, bridge input, plugin output, media sources, engine dispatch, and recovery through shared URL rules. Preserve signed path/query bytes and require confirmation for ambiguous backslashes or parser rewrites.
  • Import supported JSON and Bash cURL input with size/count bounds, expand 40-character hex and 32-character base32 BT hashes to magnet links, and route FTP through the engine's capability checks. SFTP remains deferred.
  • Retain request receipts for idempotent HTTP/FTP retries and preserve unfinished lines after partial submission.
  • Validate media redirects at each hop and bound manifest/key reads.
  • Keep the Download label fixed, blank input idle, the editor at 100px, and the collapsed window at 386px. Localize diagnostics in English, Simplified Chinese, and Traditional Chinese.

Validation / 验证

  • pnpm run check:boundaries
  • pnpm run lint
  • pnpm exec tsc --noEmit
  • Relevant automated tests / 相关自动化测试
  • Manual verification, if applicable / 必要的手动验证

Validated on macOS arm64 in an isolated checkout rebased onto current main:

  • pnpm test: 10,336 passed, 25 skipped.
  • MOTRIX_E2E_FORCE_BUILD=1 pnpm run test:e2e e2e/add-task.spec.ts: 7 passed, including dimensions, tooltip/wrapping/scrolling, correction and undo, partial submission, both bare-hash formats, HTTP, and torrent queues.
  • pnpm run check:i18n and pnpm run check:file-names: passed.
  • The required boundary/lint/type checks passed. Lint retains three existing CSS specificity warnings.
  • An earlier pre-rebase tooltip hover run timed out once; the isolated reproduction and subsequent complete runs passed. No production workaround was added for that observation.

Screenshots or recordings / 截图或录屏

URL editor with token-level diagnostics and a hover explanation (captured from the running Electron app; the screenshot covers the editor only):

URL editor with inline diagnostics

Checklist / 检查清单

  • This pull request targets main and contains one focused change.
  • User-visible text is localized, and paired English/Chinese documentation stays aligned.
  • No credentials, private URLs, personal paths, or other sensitive information are included.
  • I have read and followed the contribution guidelines and Code of Conduct.

Scope plugin abort deadlines to their invocation and validate sources before side effects across local, remote, plugin, media, and recovery paths. Preserve URL bytes, require explicit ambiguous corrections, support bare BT hashes and FTP, and retain idempotent retries.

Add inline URL diagnostics while preserving the Download label, a 100px editor, and the 386px collapsed window. Cover malformed inputs, normalized size limits, redirect validation, and bounded key responses.

Refs #2151
@agalwood
agalwood merged commit d2ada04 into main Sep 17, 2026
17 checks passed
@agalwood
agalwood deleted the fix/2151_url_admission_20260917 branch September 17, 2026 16:10
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