-
Notifications
You must be signed in to change notification settings - Fork 5
Fix truncated URLs in web search results opening broken links #388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
When web search results are collapsed, URLs were being truncated for display but the truncated text was also used as the href. Now URLs that would be cut by truncation are converted to markdown links that preserve the full URL in the href while showing truncated display text. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughAdds a helper Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
🔇 Additional comments (2)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryFixed broken links in collapsed web search results by preserving full URLs in markdown link hrefs while showing truncated display text.
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant ToolCallRenderer
participant truncateMarkdownPreservingLinks
participant Markdown
User->>ToolCallRenderer: View web search result
ToolCallRenderer->>truncateMarkdownPreservingLinks: truncate(output, 150)
alt Text length <= 150
truncateMarkdownPreservingLinks-->>ToolCallRenderer: Return original text
else Contains plain URL that would be truncated
truncateMarkdownPreservingLinks->>truncateMarkdownPreservingLinks: Find plain URLs
truncateMarkdownPreservingLinks->>truncateMarkdownPreservingLinks: Check if URL spans truncation point
truncateMarkdownPreservingLinks->>truncateMarkdownPreservingLinks: Convert to [truncated...](full-url)
truncateMarkdownPreservingLinks-->>ToolCallRenderer: Return markdown link
else Contains existing markdown link at truncation point
truncateMarkdownPreservingLinks->>truncateMarkdownPreservingLinks: Detect markdown link
truncateMarkdownPreservingLinks->>truncateMarkdownPreservingLinks: Truncate before link
truncateMarkdownPreservingLinks-->>ToolCallRenderer: Return truncated text + "..."
else Safe to truncate
truncateMarkdownPreservingLinks-->>ToolCallRenderer: Return text.substring(0, 150) + "..."
end
ToolCallRenderer->>Markdown: Render preview
Markdown-->>User: Display with clickable full URL
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 1 comment
This checks for both incomplete markdown links and URLs in the href portion. Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Deploying maple with
|
| Latest commit: |
06dab27
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://46371433.maple-ca8.pages.dev |
| Branch Preview URL: | https://linkfix.maple-ca8.pages.dev |
Greptile's behavior is changing!From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
|
|
||
| // Helper function to truncate text while preserving clickable links | ||
| // Converts plain URLs that would be truncated into markdown links with full href but truncated display | ||
| function truncateMarkdownPreservingLinks(text: string, maxLength: number): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these should move to a utility file
When web search results are collapsed, URLs were being truncated for display but the truncated text was also used as the href. Now URLs that would be cut by truncation are converted to markdown links that preserve the full URL in the href while showing truncated display text.
Fixes #387
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.