mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 20:44:32 +00:00
fix: preserve Windows cmd start URL quoting (#794) (thanks @roshanasingh4)
This commit is contained in:
@@ -232,9 +232,22 @@ function resolveSshTargetHint(): string {
|
||||
export async function openUrl(url: string): Promise<boolean> {
|
||||
const resolved = await resolveBrowserOpenCommand();
|
||||
if (!resolved.argv) return false;
|
||||
const command = [...resolved.argv, resolved.quoteUrl ? `"${url}"` : url];
|
||||
const quoteUrl = resolved.quoteUrl === true;
|
||||
const command = [...resolved.argv];
|
||||
if (quoteUrl) {
|
||||
if (command.at(-1) === "") {
|
||||
// Preserve the empty title token for `start` when using verbatim args.
|
||||
command[command.length - 1] = '""';
|
||||
}
|
||||
command.push(`"${url}"`);
|
||||
} else {
|
||||
command.push(url);
|
||||
}
|
||||
try {
|
||||
await runCommandWithTimeout(command, { timeoutMs: 5_000 });
|
||||
await runCommandWithTimeout(command, {
|
||||
timeoutMs: 5_000,
|
||||
windowsVerbatimArguments: quoteUrl,
|
||||
});
|
||||
return true;
|
||||
} catch {
|
||||
// ignore; we still print the URL for manual open
|
||||
|
||||
Reference in New Issue
Block a user