From 33d49291ecadc6df4f0472b8a06ed5139e270a12 Mon Sep 17 00:00:00 2001 From: George Smith Date: Fri, 22 Aug 2025 22:36:57 +0100 Subject: [PATCH] fix(cli): Support special characters in sandbox profile path (#2038) Co-authored-by: Jacob Richman Co-authored-by: Allen Hutchison --- packages/cli/src/utils/sandbox.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/utils/sandbox.ts b/packages/cli/src/utils/sandbox.ts index 30006422..d5c2be08 100644 --- a/packages/cli/src/utils/sandbox.ts +++ b/packages/cli/src/utils/sandbox.ts @@ -9,6 +9,7 @@ import os from 'node:os'; import path from 'node:path'; import fs from 'node:fs'; import { readFile } from 'node:fs/promises'; +import { fileURLToPath } from 'node:url'; import { quote, parse } from 'shell-quote'; import { USER_SETTINGS_DIR, @@ -200,9 +201,12 @@ export async function start_sandbox( console.error('ERROR: cannot BUILD_SANDBOX when using macOS Seatbelt'); process.exit(1); } + const profile = (process.env['SEATBELT_PROFILE'] ??= 'permissive-open'); - let profileFile = new URL(`sandbox-macos-${profile}.sb`, import.meta.url) - .pathname; + let profileFile = fileURLToPath( + new URL(`sandbox-macos-${profile}.sb`, import.meta.url), + ); + // if profile name is not recognized, then look for file under project settings directory if (!BUILTIN_SEATBELT_PROFILES.includes(profile)) { profileFile = path.join(