Skip to content

Commit 8fba446

Browse files
committed
refactor: simplify URI creation logic in createSafeContentUri function
1 parent ed73805 commit 8fba446

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/utils/uri.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ export function createSafeContentUri(scheme: string, path: string, content: stri
1717
try {
1818
const base64Content = Buffer.from(content).toString("base64")
1919
const baseUri = `${scheme}:${path}`
20-
const testUri = vscode.Uri.parse(baseUri).with({ query: base64Content }).toString()
20+
const uri = vscode.Uri.parse(baseUri).with({ query: base64Content })
2121

22-
if (testUri.length <= MAX_SAFE_URI_LENGTH) {
23-
return vscode.Uri.parse(baseUri).with({ query: base64Content })
22+
if (uri.toString().length <= MAX_SAFE_URI_LENGTH) {
23+
return uri
2424
}
2525

2626
// Calculate available space for content after accounting for URI overhead

0 commit comments

Comments
 (0)