fix: Bluesky posts rejected with "grapheme too big" error#1095
Open
Alexia-Soare wants to merge 1 commit into
Open
fix: Bluesky posts rejected with "grapheme too big" error#1095Alexia-Soare wants to merge 1 commit into
Alexia-Soare wants to merge 1 commit into
Conversation
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>
Contributor
Soare-Robert-Daniel
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 increate_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 withInvalidRequest: grapheme too big, and the post went unpublished.class-rop-content-helper.php—token_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— fixfunction_exists( 'mb_strlen ' )typo (trailing space) that silently forced byte-based hashtag length budgeting.Tests
New
bluesky-graphemePHPUnit 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.