Commit 932a247f authored by Jason Lee's avatar Jason Lee

Use CGI.escape instead of URI.escape, because URI is obsoleted.

ref: https://github.com/ruby/ruby/commit/238b979f1789f95262a267d8df6239806f2859cc
parent 41bcab11
...@@ -48,8 +48,8 @@ class WebHook < ActiveRecord::Base ...@@ -48,8 +48,8 @@ class WebHook < ActiveRecord::Base
else else
post_url = url.gsub("#{parsed_url.userinfo}@", "") post_url = url.gsub("#{parsed_url.userinfo}@", "")
auth = { auth = {
username: URI.decode(parsed_url.user), username: CGI.unescape(parsed_url.user),
password: URI.decode(parsed_url.password), password: CGI.unescape(parsed_url.password),
} }
response = WebHook.post(post_url, response = WebHook.post(post_url,
body: data.to_json, body: data.to_json,
......
...@@ -120,13 +120,13 @@ class HipchatService < Service ...@@ -120,13 +120,13 @@ class HipchatService < Service
message << "#{push[:user_name]} " message << "#{push[:user_name]} "
if Gitlab::Git.blank_ref?(before) if Gitlab::Git.blank_ref?(before)
message << "pushed new #{ref_type} <a href=\""\ message << "pushed new #{ref_type} <a href=\""\
"#{project_url}/commits/#{URI.escape(ref)}\">#{ref}</a>"\ "#{project_url}/commits/#{CGI.escape(ref)}\">#{ref}</a>"\
" to #{project_link}\n" " to #{project_link}\n"
elsif Gitlab::Git.blank_ref?(after) elsif Gitlab::Git.blank_ref?(after)
message << "removed #{ref_type} <b>#{ref}</b> from <a href=\"#{project.web_url}\">#{project_name}</a> \n" message << "removed #{ref_type} <b>#{ref}</b> from <a href=\"#{project.web_url}\">#{project_name}</a> \n"
else else
message << "pushed to #{ref_type} <a href=\""\ message << "pushed to #{ref_type} <a href=\""\
"#{project.web_url}/commits/#{URI.escape(ref)}\">#{ref}</a> " "#{project.web_url}/commits/#{CGI.escape(ref)}\">#{ref}</a> "
message << "of <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a> " message << "of <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a> "
message << "(<a href=\"#{project.web_url}/compare/#{before}...#{after}\">Compare changes</a>)" message << "(<a href=\"#{project.web_url}/compare/#{before}...#{after}\">Compare changes</a>)"
...@@ -255,8 +255,8 @@ class HipchatService < Service ...@@ -255,8 +255,8 @@ class HipchatService < Service
status = data[:commit][:status] status = data[:commit][:status]
duration = data[:commit][:duration] duration = data[:commit][:duration]
branch_link = "<a href=\"#{project_url}/commits/#{URI.escape(ref)}\">#{ref}</a>" branch_link = "<a href=\"#{project_url}/commits/#{CGI.escape(ref)}\">#{ref}</a>"
commit_link = "<a href=\"#{project_url}/commit/#{URI.escape(sha)}/builds\">#{Commit.truncate_sha(sha)}</a>" commit_link = "<a href=\"#{project_url}/commit/#{CGI.escape(sha)}/builds\">#{Commit.truncate_sha(sha)}</a>"
"#{project_link}: Commit #{commit_link} of #{branch_link} #{ref_type} by #{user_name} #{humanized_status(status)} in #{duration} second(s)" "#{project_link}: Commit #{commit_link} of #{branch_link} #{ref_type} by #{user_name} #{humanized_status(status)} in #{duration} second(s)"
end end
......
...@@ -11,7 +11,7 @@ class Settings < Settingslogic ...@@ -11,7 +11,7 @@ class Settings < Settingslogic
# get host without www, thanks to http://stackoverflow.com/a/6674363/1233435 # get host without www, thanks to http://stackoverflow.com/a/6674363/1233435
def get_host_without_www(url) def get_host_without_www(url)
url = URI.encode(url) url = CGI.escape(url)
uri = URI.parse(url) uri = URI.parse(url)
uri = URI.parse("http://#{url}") if uri.scheme.nil? uri = URI.parse("http://#{url}") if uri.scheme.nil?
host = uri.host.downcase host = uri.host.downcase
......
...@@ -12,7 +12,7 @@ module Gitlab ...@@ -12,7 +12,7 @@ module Gitlab
end end
def execute def execute
project_identifier = URI.encode(project.import_source, '/') project_identifier = CGI.escape(project.import_source, '/')
#Issues && Comments #Issues && Comments
issues = client.issues(project_identifier) issues = client.issues(project_identifier)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment