Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ function getComposerURI(webView: Webview): string {
function getComposerCSSFiles(disableComDebug: boolean, devHost: string, webView: Webview): string[] {
const filePath = join((extension.ballerinaExtInstance.context as ExtensionContext).extensionPath, 'resources', 'jslibs', 'themes', 'ballerina-default.min.css');
return [
(isDevMode && !disableComDebug) ? join(devHost, 'themes', 'ballerina-default.min.css')
(isDevMode && !disableComDebug) ? `${devHost}/themes/ballerina-default.min.css`
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If devHost is configured with a trailing slash (e.g., http://localhost:port/), this will produce a double-slash URL (...//themes/...). Consider normalizing devHost (trim trailing /) once, or use new URL('/themes/ballerina-default.min.css', devHost).toString() to build a correct URL robustly.

Copilot uses AI. Check for mistakes.
: webView.asWebviewUri(Uri.file(filePath)).toString()
];
}

function getComposerJSFiles(componentName: string, disableComDebug: boolean, devHost: string, webView: Webview): string[] {
const filePath = join((extension.ballerinaExtInstance.context as ExtensionContext).extensionPath, 'resources', 'jslibs') + sep + componentName + '.js';
return [
(isDevMode && !disableComDebug) ? join(devHost, componentName + '.js')
(isDevMode && !disableComDebug) ? `${devHost}/${componentName}.js`
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same URL-joining issue as above: a trailing slash in devHost will yield ...//<component>.js, and special characters in componentName aren’t URL-encoded. Consider using new URL(\/${componentName}.js`, devHost).toString()(and ensurecomponentName` is a safe path segment) for consistent URL construction.

Copilot uses AI. Check for mistakes.
: webView.asWebviewUri(Uri.file(filePath)).toString(),
isDevMode ? 'http://localhost:8097' : '' // For React Dev Tools
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ function extractBinary(archivePath, platform, destDir) {

try {
if (platform.ext === '.tar.gz') {
execSync(`tar -xzf '${archivePath}' -C '${tmpExtractDir}'`, { stdio: 'inherit' });
execSync(`tar -xzf "${archivePath}" -C "${tmpExtractDir}"`, { stdio: 'inherit' });
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using execSync with interpolated paths can break when archivePath or tmpExtractDir contains double quotes, and it also increases command-injection risk if those values are ever influenced externally. Prefer execFileSync('tar', ['-xzf', archivePath, '-C', tmpExtractDir], { stdio: 'inherit' }) (or spawnSync) to avoid shell parsing/quoting issues entirely.

Copilot uses AI. Check for mistakes.
} else if (platform.ext === '.zip') {
if (os.platform() === 'win32') {
execSync(`powershell.exe -Command "Expand-Archive -Path '${archivePath}' -DestinationPath '${tmpExtractDir}' -Force"`, { stdio: 'inherit' });
Expand Down
Loading