Skip to content

Commit 6b53750

Browse files
author
Eric Wheeler
committed
feat: add URL tooltips and improve link safety
Add tooltips showing full URL when hovering over links. Add safety checks to only process local file paths: - file:// protocol URLs - absolute paths starting with / - relative paths without protocol Move preventDefault() after path validation to allow external links to work normally. Signed-off-by: Eric Wheeler <[email protected]>
1 parent bd7cecd commit 6b53750

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

webview-ui/src/components/common/MarkdownBlock.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,18 @@ const MarkdownBlock = memo(({ markdown }: MarkdownBlockProps) => {
146146
return (
147147
<a
148148
href={href}
149+
title={href}
149150
onClick={(e) => {
151+
// Only process file:// protocol or local file paths
152+
const isLocalPath =
153+
href.startsWith("file://") || href.startsWith("/") || !href.includes("://")
154+
155+
if (!isLocalPath) {
156+
return
157+
}
158+
150159
e.preventDefault()
160+
151161
// Handle absolute vs project-relative paths
152162
let filePath = href.replace("file://", "")
153163

0 commit comments

Comments
 (0)