-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
remove_label fails with 404 when label name contains spaces #560
Comments
domcleal
pushed a commit
to theforeman/prprocessor
that referenced
this issue
Feb 13, 2015
@pengwynn I'm getting a 404 when deleting a label with a forward slash in it e.g. ("foo/bar"). Octokit 4.6.2. Should I open up a new issue or is this accepted behavior?
|
@kareem we may have had a regression since bumping Addressable in the past two years. A new issue would be great. Bonus points for patch or at least a failing test. 👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
client.remove_label(repo, pr, 'help wanted')
fails with a 404 response from the GitHub API even when the "help wanted" label exists, as the spaces in the label name aren't escaped correctly.remove_label (and other methods in the same file) uses CGI.escape on the label name before making the request (https://github.com/octokit/octokit.rb/blob/568745f/lib/octokit/client/labels.rb#L88). CGI.escape is escaping the space as a + rather than %20, which the API doesn't appear to accept.
The request method escapes too (https://github.com/octokit/octokit.rb/blob/568745f/lib/octokit/client.rb#L339), but this isn't complete - it won't escape special URL characters such as "?" in label names, so removing CGI.escape would break those labels instead. Unfortunately changing CGI.escape to another method (ERB::Util.url_encode?) that escapes spaces as %20 will only cause the % to be escaped again in the request method.
The text was updated successfully, but these errors were encountered: