Skip to content

fix: Bluesky posts rejected with "grapheme too big" error#1095

Open
Alexia-Soare wants to merge 1 commit into
developmentfrom
fix/bluesky-error
Open

fix: Bluesky posts rejected with "grapheme too big" error#1095
Alexia-Soare wants to merge 1 commit into
developmentfrom
fix/bluesky-error

Conversation

@Alexia-Soare

@Alexia-Soare Alexia-Soare commented Jul 15, 2026

Copy link
Copy Markdown

Fixes Codeinwp/tweet-old-post-pro#677

Changes

  • class-rop-bluesky-api.php — clamp final post text (content + hashtags) to Bluesky's 300-grapheme limit in create_post(), the chokepoint for both scheduled and immediate shares. Previously, a max length set above 300 or hashtags appended after truncation produced records the API rejected with InvalidRequest: grapheme too big, and the post went unpublished.
  • class-rop-content-helper.phptoken_truncate() now counts characters (mb_*) instead of bytes, fixing over-truncation of accented/CJK/emoji content on all networks.
  • class-rop-post-format-helper.php — fix function_exists( 'mb_strlen ' ) typo (trailing space) that silently forced byte-based hashtag length budgeting.

Tests

New bluesky-grapheme PHPUnit suite reproduces the issue at the outbound HTTP boundary (pre_http_request, no Bluesky account needed): red without the fix (310/316 graphemes sent), green with it.

Clamp the final post text to Bluesky's 300-grapheme limit in create_post(),
make token_truncate() count characters instead of bytes, and fix the
function_exists( 'mb_strlen ' ) typo that forced byte-based hashtag budgeting.

Fixes Codeinwp/tweet-old-post-pro#677

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Alexia-Soare Alexia-Soare added the pr-checklist-skip Allow this Pull Request to skip checklist. label Jul 15, 2026
@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label Jul 15, 2026
@pirate-bot

Copy link
Copy Markdown
Contributor

Plugin build for 7c53a16 is ready 🛎️!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-complete The Pull Request checklist is complete. (automatic label) pr-checklist-skip Allow this Pull Request to skip checklist.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants