Skip to content

Commit 9b8f0c1

Browse files
Trim social follow targets (#735)
1 parent c794db7 commit 9b8f0c1

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

packages/cli/src/social-follow.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ describe('social follow target parsing', () => {
2222
});
2323
});
2424

25+
it('trims whitespace around Bluesky handles and URLs', () => {
26+
expect(parseSocialFollowTarget(' @alice.bsky.social ', 'bluesky')).toEqual({
27+
platform: 'bluesky',
28+
actor: 'alice.bsky.social',
29+
source: 'profile',
30+
});
31+
expect(parseSocialFollowTarget(' https://bsky.app/profile/source.bsky.social/followers ')).toEqual({
32+
platform: 'bluesky',
33+
actor: 'source.bsky.social',
34+
source: 'followers',
35+
});
36+
});
37+
2538
it('rejects unsupported social URLs', () => {
2639
expect(() => parseSocialFollowTarget('https://example.com/alice')).toThrow('only supports bsky.app URLs');
2740
});

packages/cli/src/social-follow.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ interface BlueskyCreateRecordResponse extends BlueskyErrorResponse {
7474
}
7575

7676
export function parseSocialFollowTarget(input: string, explicitPlatform?: string): SocialFollowTarget {
77+
input = input.trim();
7778
const platform = normalizePlatform(explicitPlatform);
7879
if (platform && platform !== 'bluesky') {
7980
throw new Error(`social follow only supports Bluesky URLs today; got --platform ${explicitPlatform}`);

0 commit comments

Comments
 (0)