Skip to content

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

Merged
selul merged 2 commits into
developmentfrom
fix/bluesky-error
Jul 21, 2026
Merged

fix: Bluesky posts rejected with "grapheme too big" error#1095
selul merged 2 commits into
developmentfrom
fix/bluesky-error

Conversation

@Alexia-Soare

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

Copy link
Copy Markdown
Contributor

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

pirate-bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Plugin build for 547747c is ready 🛎️!

@selul

selul commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved. The only conflict was in phpunit.xml where both branches added a new test suite entry — bluesky-grapheme (this PR) and bluesky-card (development). Both entries are now preserved in the merged result (547747c).

Copilot finished work on behalf of selul July 21, 2026 08:14
Copilot Bot requested a review from selul July 21, 2026 08:14
@selul
selul merged commit 2979966 into development Jul 21, 2026
@pirate-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 9.4.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Aug 4, 2026
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. released Indicate that an issue has been resolved and released in a particular version of the product.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants