Skip to content
Merged
Changes from all commits
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
11 changes: 10 additions & 1 deletion src/commands/org/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,16 @@ export class OrgOpenCommand extends SfCommand<OrgOpenOutput> {

// 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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

retUrl can be either a generated path from --source-file or --path.
If the former that's fine because it doesn't get encoded in generateFileUrl, so we only check for flags.path.

)
);
const cp = await utils.openUrl(`file:///${tempFilePath}`, {
...(flags.browser ? { app: { name: apps[flags.browser] } } : {}),
...(flags.private ? { newInstance: platform() === 'darwin', app: { name: apps.browserPrivate } } : {}),
Expand Down