From cbce1d79c20371ba379e2a5207bf5f294845e1f2 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 2 Jul 2025 10:40:52 +0000 Subject: [PATCH] fix(share): Ensure shared file previews use truncated content 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. --- packages/web/src/components/Share.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/web/src/components/Share.tsx b/packages/web/src/components/Share.tsx index 93aad6e61686..fd828629e79c 100644 --- a/packages/web/src/components/Share.tsx +++ b/packages/web/src/components/Share.tsx @@ -1346,7 +1346,8 @@ export default function Share(props: { - + {/* Always try to show CodeBlock if preview is available (even if empty string) */} +
- + {/* Fallback to TextPart if preview is not a string (e.g. undefined) AND result exists */} +