Skip to content

fix: use maxLength parameter in truncateOnWord instead of hardcoded value#27961

Merged
romitg2 merged 2 commits intocalcom:mainfrom
AritraDey-Dev:pr/aritra-fix-truncate
Feb 15, 2026
Merged

fix: use maxLength parameter in truncateOnWord instead of hardcoded value#27961
romitg2 merged 2 commits intocalcom:mainfrom
AritraDey-Dev:pr/aritra-fix-truncate

Conversation

@AritraDey-Dev
Copy link
Copy Markdown
Contributor

What does this PR do?

This PR fixes the truncateOnWord function to correctly use the maxLength parameter provided by caller functions instead of a hardcoded value of 148. This ensures that OpenGraph metadata (which calls this function with a limit of 158 characters) can now utilize the full intended length for previews.

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • NA
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Feb 14, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copy link
Copy Markdown
Member

@romitg2 romitg2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@romitg2 romitg2 added the run-ci Approve CI to run for external contributors label Feb 15, 2026
@romitg2 romitg2 enabled auto-merge (squash) February 15, 2026 09:50
@romitg2 romitg2 merged commit ea0c92a into calcom:main Feb 15, 2026
101 of 111 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Created by Linear-GitHub Sync ready-for-e2e run-ci Approve CI to run for external contributors size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants