Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Handle github usernames and passwords with special chars

  • Loading branch information...
commit 1fc0d29b9386f8915a3cf7e5b74b5bc8979952aa 1 parent 5314861
@wagenet wagenet authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/github_uploader.rb
View
4 lib/github_uploader.rb
@@ -26,6 +26,8 @@ def check_token
def authorize
return if authorized?
+ require 'cgi'
+
puts "There is no file named .github-upload-token in this folder. This file holds the OAuth token needed to communicate with GitHub."
puts "You will be asked to enter your GitHub password so a new OAuth token will be created."
print "GitHub Password: "
@@ -35,7 +37,7 @@ def authorize
puts ""
# check if the user already granted access for Ember.js Uploader by checking the available authorizations
- response = RestClient.get "https://#{@login}:#{pw}@api.github.com/authorizations"
+ response = RestClient.get "https://#{CGI.escape(@login)}:#{CGI.escape(pw)}@api.github.com/authorizations"
JSON.parse(response.to_str).each do |auth|
if auth["note"] == "Ember.js Uploader"
# user already granted access, so we reuse the existing token
Please sign in to comment.
Something went wrong with that request. Please try again.