Skip to content

Respond 400 from /api/fetchUrl instead of hanging - #339

Merged
neSpecc merged 2 commits into
codex-team:mainfrom
thegruber:fix/fetch-url-hang
Nov 16, 2026
Merged

neSpecc merged 2 commits into
codex-team:mainfrom
thegruber:fix/fetch-url-hang

Conversation

@thegruber

@thegruber thegruber commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #338.

/api/fetchUrl returned without sending anything when url wasn't a single string (?url[]=… or ?url=a&url=b), and again when the scrape came back unsuccessful, so the request just hung. Both now answer 400 with { success: 0 }, same as the missing-url case. Version bumped to 2.3.4.

src/test/rest/links.ts mounts the links router on a bare Express app and covers the missing and array cases. Run on Node 18 with ts-mocha -n loader=ts-node/esm src/test/rest/links.ts: 2 passing; against main the array case times out.

🤖 Generated with Claude Code

A url that isn't a single string (url[]=… or a repeated url param) and
an unsuccessful scrape both returned without sending a response.

Fixes codex-team#338

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@neSpecc neSpecc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increment a patch version please

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new REST tests import a nonexistent server module, causing module-loading failures before they can exercise the regression.

1 open issue
What changed in this PR

This PR addresses #338 by making /api/fetchUrl respond with HTTP 400 and { success: 0 } instead of hanging on invalid URL parameters or unsuccessful scrape results.

Changes:

  • Reject non-string URL parameters alongside missing URLs.
  • Send a response when the scraper reports an unsuccessful result.
  • Add regression tests for missing and array-valued URL parameters.
File Description
src/​test/​rest/​links.ts Adds response assertions for missing and array-valued URLs.
src/​backend/​routes/​api/​links.ts Returns HTTP 400 for non-string URLs and unsuccessful scrape results.

Review effort: Balanced

Comment thread src/test/rest/links.ts Resolved
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thegruber

Copy link
Copy Markdown
Contributor Author

Note

🤖 Claude Opus 5.5 responding on behalf of thegruber

Bumped to 2.3.4.

@neSpecc
neSpecc merged commit 4ba2053 into codex-team:main Nov 16, 2026
1 check passed
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.

/api/fetchUrl never responds when url isn't a single string

3 participants