Skip to content

Commit 5d3f45b

Browse files
committed
fix(image-uris): broaden Unix path regex to include common Linux roots
Use /^[^?#]*\/(?:Users|home|root|var|tmp|opt)\/[^?#]{1,300}\.(png|jpg|jpeg|gif|webp)$/i to support Linux/macOS while keeping bounds and avoiding backtracking.
1 parent 634ee67 commit 5d3f45b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/integrations/misc/imageDataUrl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function webviewUriToFilePath(webviewUri: string): string {
8585
// Use specific, bounded patterns to prevent ReDoS
8686
// Match exact patterns without backtracking
8787
const unixMatch = decoded.match(
88-
/^[^?#]*\/Users\/[a-zA-Z0-9._-]{1,50}\/[^?#]{1,300}\.(png|jpg|jpeg|gif|webp)$/i,
88+
/^[^?#]*\/(?:Users|home|root|var|tmp|opt)\/[^?#]{1,300}\.(png|jpg|jpeg|gif|webp)$/i,
8989
)
9090
if (unixMatch) {
9191
return unixMatch[0]

0 commit comments

Comments
 (0)