Skip to content

Commit

Permalink
Join upload path to push-url while parsing.
Browse files Browse the repository at this point in the history
This stops the send_gem command from failing if the
url in the config file contains a trailing slash.
  • Loading branch information
Jakob Holderbaum authored and tomlea committed Jan 20, 2012
1 parent 2c658c3 commit 58a673f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/rubygems/commands/inabox_command.rb
Expand Up @@ -52,18 +52,20 @@ def find_gem

def send_gem
# sanitize printed URL if a password is present
url = URI.parse(geminabox_host)
url = URI.join(geminabox_host, "upload")

url_for_presentation = url.clone
url_for_presentation.password = '***' if url_for_presentation.password


@gemfiles.each do |gemfile|
say "Pushing #{File.basename(gemfile)} to #{url_for_presentation}..."

File.open(gemfile, "rb") do |file|
request_body, request_headers = Multipart::MultipartPost.new.prepare_query("file" => file)

proxy.start(url.host, url.port) {|con|
req = Net::HTTP::Post.new(url.path+'/upload', request_headers)
req = Net::HTTP::Post.new(url.path, request_headers)
req.basic_auth(url.user, url.password) if url.user
handle_response(con.request(req, request_body))
}
Expand Down

0 comments on commit 58a673f

Please sign in to comment.