fix(cli): handle malformed Bluesky profile URLs#728
Conversation
Greptile SummaryThis PR adds a try/catch around the
Confidence Score: 5/5Safe to merge — the change is a minimal, well-scoped guard on a single error path with a matching regression test. The fix wraps exactly the code that can throw a URIError, the new error message is consistent with surrounding error messages in the same function, and the regression test correctly exercises the incomplete percent-encoding case. No existing behaviour is altered for valid inputs. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[parseSocialFollowTarget input] --> B{new URL succeeds?}
B -- No --> C{bluesky platform or actor-like?}
C -- Yes --> D[Return bare actor target]
C -- No --> E[Throw: Expected a social account URL]
B -- Yes --> F{host === bsky.app?}
F -- No --> G[Throw: only supports bsky.app URLs]
F -- Yes --> H[try: pathname.split.filter.map decodeURIComponent]
H -- URIError / any error --> I[Throw: Could not parse Bluesky profile URL input]
H -- Success --> J{profileIndex found?}
J -- No --> K[Throw: Could not find handle or DID]
J -- Yes --> L[Extract actor and source tab]
L --> M[Return SocialFollowTarget]
Reviews (2): Last reviewed commit: "fix(cli): handle malformed Bluesky profi..." | Re-trigger Greptile |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
08cf739 to
508799e
Compare
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
8 similar comments
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
Summary
Closes #727
Validation
pnpm exec vitest run packages/cli/src/social-follow.test.ts(7 tests passed)pnpm --filter @profullstack/sh1pt... buildpnpm --filter @profullstack/sh1pt typecheck