Skip to content

Commit c7009fb

Browse files
authored
fix: decode path flag before writing it to form (#934)
1 parent 574d5ae commit c7009fb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/commands/org/open.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,16 @@ export class OrgOpenCommand extends SfCommand<OrgOpenOutput> {
130130

131131
// create a local html file that contains the POST stuff.
132132
const tempFilePath = path.join(tmpdir(), `org-open-${new Date().valueOf()}.html`);
133-
await fs.promises.writeFile(tempFilePath, getFileContents(conn.accessToken as string, conn.instanceUrl, retUrl));
133+
await fs.promises.writeFile(
134+
tempFilePath,
135+
getFileContents(
136+
conn.accessToken as string,
137+
conn.instanceUrl,
138+
// the path flag is URI-encoded in its `parse` func.
139+
// For the form redirect to work we need it decoded.
140+
flags.path ? decodeURIComponent(flags.path) : retUrl
141+
)
142+
);
134143
const cp = await utils.openUrl(`file:///${tempFilePath}`, {
135144
...(flags.browser ? { app: { name: apps[flags.browser] } } : {}),
136145
...(flags.private ? { newInstance: platform() === 'darwin', app: { name: apps.browserPrivate } } : {}),

0 commit comments

Comments
 (0)