Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use homefolder for org open under linux to prevent issues with sandboxing through snap #992

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 9 additions & 1 deletion src/commands/org/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,15 @@ 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`);
let tempFilePath = path.join(tmpdir(), `org-open-${new Date().valueOf()}.html`);

if( platform() === 'linux'){
// on linux create the temp file in the home folder as e.g. snaps can not access /tmp
let folderPath = path.join(homedir(), `temp`);
await fs.promises.mkdir(folderPath, { recursive: true });
tempFilePath = path.join(homedir(), `temp`, `org-open-${new Date().valueOf()}.html`);
}

await fs.promises.writeFile(
tempFilePath,
getFileContents(
Expand Down