-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Describe the feature or problem you’d like to solve
Recently I've been using gh in a few automated scripts. One of which I need to copy the url from a current directory using gh browse -n . and post it using a discord bot. Granted, I know it's frowned upon usually to put spaces in file / folder names, but I have good reason for a certain repo. When running this script in this particular repo, this is the output I get:
$ gh browse -n '78. Subsets .go'
https://github.com/bchadwic/BoardMasters-Question-Of-The-Day/tree/main/golang/78. Subsets .go
When posting this output, it becomes unusable given that it's only recognized up to the .../78. as a url.
Proposed solution
I believe it is standard for url's to have a %20 in place of spaces before the query parameter part. Since there are no query parameters being added onto gh browse's output, could all the spaces be converted to %20?
Ex:
$ gh browse -n '78. Subsets .go'
https://github.com/bchadwic/BoardMasters-Question-Of-The-Day/blob/main/golang/78.%20Subsets%20.go
This would help avoid bugs for people trying to use this command in a script given that they might expect one string instead of it being broken up.
Additional context
found this about url encoding:
https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20