From 6777177ea95c3f1d52e0cbfcc91783a9710c4de0 Mon Sep 17 00:00:00 2001 From: Cristian Dominguez Date: Tue, 16 Jan 2024 12:06:03 -0300 Subject: [PATCH] fix: decode `path` flag before writing it to form --- src/commands/org/open.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/commands/org/open.ts b/src/commands/org/open.ts index 2482c12c..03564844 100644 --- a/src/commands/org/open.ts +++ b/src/commands/org/open.ts @@ -130,7 +130,16 @@ export class OrgOpenCommand extends SfCommand { // create a local html file that contains the POST stuff. const tempFilePath = path.join(tmpdir(), `org-open-${new Date().valueOf()}.html`); - await fs.promises.writeFile(tempFilePath, getFileContents(conn.accessToken as string, conn.instanceUrl, retUrl)); + await fs.promises.writeFile( + tempFilePath, + getFileContents( + conn.accessToken as string, + conn.instanceUrl, + // the path flag is URI-encoded in its `parse` func. + // For the form redirect to work we need it decoded. + flags.path ? decodeURIComponent(flags.path) : retUrl + ) + ); const cp = await utils.openUrl(`file:///${tempFilePath}`, { ...(flags.browser ? { app: { name: apps[flags.browser] } } : {}), ...(flags.private ? { newInstance: platform() === 'darwin', app: { name: apps.browserPrivate } } : {}),