Skip to content

fix(cli): handle malformed Bluesky profile URLs#728

Merged
ralyodio merged 1 commit into
profullstack:masterfrom
rissrice2105-agent:fix/bluesky-malformed-profile-url
Jun 14, 2026
Merged

fix(cli): handle malformed Bluesky profile URLs#728
ralyodio merged 1 commit into
profullstack:masterfrom
rissrice2105-agent:fix/bluesky-malformed-profile-url

Conversation

@rissrice2105-agent

Copy link
Copy Markdown
Contributor

Summary

  • catch malformed percent-encoding in Bluesky profile URL paths
  • return a clear user-facing validation error instead of a raw URIError
  • add a focused regression test

Closes #727

Validation

  • pnpm exec vitest run packages/cli/src/social-follow.test.ts (7 tests passed)
  • pnpm --filter @profullstack/sh1pt... build
  • pnpm --filter @profullstack/sh1pt typecheck

@greptile-apps

greptile-apps Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a try/catch around the decodeURIComponent mapping over Bluesky URL path segments, converting the raw URIError that is thrown for malformed percent-encoding (e.g. %E0%A4%A) into a user-friendly validation error. A focused regression test covers the new branch.

  • social-follow.ts: Wraps url.pathname.split('/').filter(Boolean).map(decodeURIComponent) in a try/catch that rethrows as a readable Error containing the original input.
  • social-follow.test.ts: Adds one regression test asserting that a URL with an incomplete percent-encoding sequence throws the expected message rather than a raw URIError.

Confidence Score: 5/5

Safe 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

Filename Overview
packages/cli/src/social-follow.ts Adds a try/catch around the decodeURIComponent map call to surface a clear validation error instead of a raw URIError for malformed Bluesky profile URL paths.
packages/cli/src/social-follow.test.ts Adds one regression test for the malformed percent-encoding case; test input and assertion match the implementation correctly.

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]
Loading

Reviews (2): Last reviewed commit: "fix(cli): handle malformed Bluesky profi..." | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown

🤖 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: git fetch upstream master && git rebase upstream/master.

@rissrice2105-agent rissrice2105-agent force-pushed the fix/bluesky-malformed-profile-url branch from 08cf739 to 508799e Compare June 14, 2026 01:52
@github-actions

Copy link
Copy Markdown

🤖 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: git fetch upstream master && git rebase upstream/master.

8 similar comments
@github-actions

Copy link
Copy Markdown

🤖 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: git fetch upstream master && git rebase upstream/master.

@github-actions

Copy link
Copy Markdown

🤖 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: git fetch upstream master && git rebase upstream/master.

@github-actions

Copy link
Copy Markdown

🤖 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: git fetch upstream master && git rebase upstream/master.

@github-actions

Copy link
Copy Markdown

🤖 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: git fetch upstream master && git rebase upstream/master.

@github-actions

Copy link
Copy Markdown

🤖 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: git fetch upstream master && git rebase upstream/master.

@github-actions

Copy link
Copy Markdown

🤖 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: git fetch upstream master && git rebase upstream/master.

@github-actions

Copy link
Copy Markdown

🤖 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: git fetch upstream master && git rebase upstream/master.

@github-actions

Copy link
Copy Markdown

🤖 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: git fetch upstream master && git rebase upstream/master.

@ralyodio ralyodio merged commit 1be9efe into profullstack:master Jun 14, 2026
5 checks 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.

Malformed Bluesky profile URLs throw an internal URIError

2 participants