[PR #607] [MERGED] fix: Ensure shared file previews use truncated content #9659

Closed
opened 2026-02-16 18:13:56 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/607
Author: @ghost
Created: 7/2/2025
Status: Merged
Merged: 7/2/2025
Merged by: @thdxr

Base: devHead: fix/share-data-exposure


📝 Commits (1)

  • cbce1d7 fix(share): Ensure shared file previews use truncated content

📊 Changes

1 file changed (+4 additions, -2 deletions)

View changed files

📝 packages/web/src/components/Share.tsx (+4 -2)

📄 Description

The read tool's display in the share view was unintentionally falling back to rendering the full tool output if the specific metadata.preview (max 20 lines) was an empty string. This could lead to more data being embedded in the page source than implied by the UI.

This commit modifies the Share.tsx component to ensure that the CodeBlock for the read tool prioritizes metadata.preview even if it's an empty string. The fallback to showing the full tool result via TextPart is now more restrictive and less likely to be triggered for the read tool, thus preventing excessive data exposure in the preview.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/607 **Author:** [@ghost](https://github.com/ghost) **Created:** 7/2/2025 **Status:** ✅ Merged **Merged:** 7/2/2025 **Merged by:** [@thdxr](https://github.com/thdxr) **Base:** `dev` ← **Head:** `fix/share-data-exposure` --- ### 📝 Commits (1) - [`cbce1d7`](https://github.com/anomalyco/opencode/commit/cbce1d79c20371ba379e2a5207bf5f294845e1f2) fix(share): Ensure shared file previews use truncated content ### 📊 Changes **1 file changed** (+4 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/web/src/components/Share.tsx` (+4 -2) </details> ### 📄 Description The read tool's display in the share view was unintentionally falling back to rendering the full tool output if the specific metadata.preview (max 20 lines) was an empty string. This could lead to more data being embedded in the page source than implied by the UI. This commit modifies the Share.tsx component to ensure that the CodeBlock for the read tool prioritizes metadata.preview even if it's an empty string. The fallback to showing the full tool result via TextPart is now more restrictive and less likely to be triggered for the read tool, thus preventing excessive data exposure in the preview. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:13:56 -05:00
yindo closed this issue 2026-02-16 18:13:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9659