paulirish / git-open

Type `git open` to open the GitHub page or website for a repository in your browser.
MIT License
3.29k stars 246 forks source link

Fix suffix with `=` in it #166

Closed glostis closed 4 years ago

glostis commented 4 years ago

Hi!

Thanks for this very useful tool, I use it daily!

I've noticed that cases where the --suffix value contains = signs were incorrectly handled.

For example, when in this repo:

$ git open -p --suffix="anySuffix?hello=world"
https://github.com/paulirish/git-open/anySuffix?hello

# we would expect https://github.com/paulirish/git-open/anySuffix?hello=world instead

This is due to how the parsing of the --suffix value is parsed. The --suffix=value is split by =, and then the element 1 of the array is taken (which leaves out anything that comes after an = sign in value): https://github.com/paulirish/git-open/blob/d9a0d19ce291ab09d182e389edaa278bb2febb11/git-open#L48-L49

I've changed that by taking all elements of the array from 1 until the end, and then joining the array by =.

glostis commented 4 years ago

I've included commit 3bd3524 which is unrelated to my PR, but fixes the failing CI build.

CI on this repo started failing a few months ago when the shellcheck version installed in the CI job changed from 0.4.6 to 0.6.0. In shellcheck 0.6.0 a new check was added where -n is recommended instead of ! -z.

If you prefer to have this as a separate PR I can open a new one!

derimagia commented 4 years ago

Looks good to me. Thank you