fix(scan): reject unreachable manual URLs and soften transport errors - #3326
posthog-eu[bot] wants to merge 1 commit into
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Merging this PR will improve performance by 82.22%
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
|
@coderabbitai review |
|
@cursor review |
|
@coderabbitai review |
|
@coderabbitai full review |
|
@coderabbitai review |
|
@coderabbitai review |
|
@coderabbitai review |
|
@coderabbitai help |
|
@coderabbitai review |
|
@coderabbitai full review |
|
@coderabbitai full review |
|
@coderabbitai full review coderabbit-trigger:af08a765ffa515ef4ac82848659991210f47104e |
|
@coderabbitai full review Please review current HEAD. Ignore prior CI-only commits that only tipped CodeRabbit; a cleanup to product-only diff is in flight if still present. |
The manual URL field prepended `https://` to any input and accepted it as
long as `new URL()` parsed, so a single word with no dot (for example
"capago" -> "https://capago") reached the native downloader and failed with
a raw iOS message ("A server with the specified hostname could not be
found").
- Reject an http(s) host with no dot, IP literal, or explicit local host
before submitting or downloading, via `isReachableHttpUrl`.
- Map transport failures to plain guidance ("That address could not be
reached...") instead of echoing the raw platform error, via
`isNetworkReachabilityError`; the raw error stays in the debug log.
- Preview payload route: pass the underlying DB error as the `simpleError`
cause so `onError` classifies a transient Postgres hiccup as a retryable
503 instead of a bare 500 / misleading 400.
Extracted the pure URL helpers into `previewLinks.ts` for unit coverage.
Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
af08a76 to
d20b41e
Compare
|
|
@coderabbitai full review |
1 similar comment
|
@coderabbitai full review |



Summary (AI generated)
Fixes two failures on the mobile scan screen (
src/pages/scan.vue), plus aresilience gap on the preview payload route.
https://to any input, so a single word with no dot ("capago" ->https://capago) parsed fine and went straight to the native downloader,which failed with a raw platform DNS error. Submission now requires a dotted
domain, an IP literal, or an explicit local host (
isReachableHttpUrl).platform string ("A server with the specified hostname could not be found").
They map to
That address could not be reached. Check the link and your connection, then try again.The raw error is still kept in the debug log.files/preview.tsnow passes theunderlying database error as the
simpleErrorcause, soonErrorclassifiesa transient Postgres timeout as a retryable
503 upstream_unavailableinstead of a bare
500(or a misleading400 bundle_not_found).The pure URL/error helpers moved into
src/services/previewLinks.tsso they canbe unit-tested.
Test plan (AI generated)
bunx vitest run tests/preview-links.unit.test.ts tests/preview-payload-db-error.unit.test.ts(added):https://capago) is rejected; dotted domains, IPs,localhost,and
[::1]are accepted.httpsotherwise.classified transient (drives the 503); a genuine missing bundle stays a
non-transient 400.
bun typecheckandeslinton the touched files pass.Screenshots (AI generated)
Not captured. The affected states are native-download failure paths (iOS
updater / fetch transport errors) that cannot be reproduced in the web preview.
The change is input validation plus error copy; behavior is covered by the unit
tests above.
Checklist
touched files.
flow not reproducible here).
Created with PostHog Desktop from this inbox report.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.