common-fate / granted

The easiest way to access your cloud.
https://granted.dev
MIT License
964 stars 91 forks source link

Google Chrome and Chromium-based browsers don't open for profiles containing slashes in their name #524

Closed chrnorm closed 9 months ago

chrnorm commented 9 months ago

If a profile contains slashes in the name, like assume -c my/profile, Chrome will not open. This is because of the args that are passed to Chrome:

/usr/bin/google-chrome-stable --profile-directory=my/profile --no-first-run --no-default-browser-check https://signin.aws.amazon.com/federation?Action=login&Destination=https%3A%2F%2Fconsole.aws.amazon.com%2Fconsole%2Fhome%3Fregion%3Dus-east-1&Issuer=&SigninToken=

We don't escape the slashes in the --profile-directory arg, which I suspect is causing it to fail as the my directory doesn't exist in my example above.

To solve this we need to escape slashes in --profile-directory - we can replace them with - instead in the argument. e.g.

/usr/bin/google-chrome-stable --profile-directory=my-profile --no-first-run --no-default-browser-check https://signin.aws.amazon.com/federation?Action=login&Destination=https%3A%2F%2Fconsole.aws.amazon.com%2Fconsole%2Fhome%3Fregion%3Dus-east-1&Issuer=&SigninToken=