fix: use maxLength parameter in truncateOnWord instead of hardcoded value#27961
Merged
romitg2 merged 2 commits intocalcom:mainfrom Feb 15, 2026
Merged
fix: use maxLength parameter in truncateOnWord instead of hardcoded value#27961romitg2 merged 2 commits intocalcom:mainfrom
truncateOnWord instead of hardcoded value#27961romitg2 merged 2 commits intocalcom:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/lib/text.ts">
<violation number="1" location="packages/lib/text.ts:11">
P2: If no spaces exist in the truncated segment, `lastIndexOf` returns -1 and the function returns only "...", losing all content for long words/URLs when maxLength is small.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
…alue Signed-off-by: Aritra Dey <adey01027@gmail.com>
f24ab7a to
d558423
Compare
emrysal
pushed a commit
that referenced
this pull request
Feb 18, 2026
…alue (#27961) Signed-off-by: Aritra Dey <adey01027@gmail.com> Co-authored-by: Romit <85230081+romitg2@users.noreply.github.com>
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.
What does this PR do?
This PR fixes the
truncateOnWordfunction to correctly use themaxLengthparameter provided by caller functions instead of a hardcoded value of 148. This ensures thatOpenGraphmetadata (which calls this function with a limit of 158 characters) can now utilize the full intended length for previews.Mandatory Tasks (DO NOT REMOVE)