diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb index 9c6fe7dab21e7b1d9166b3781ff8f2cc1e5753ae..4c4c5cba60f27ad86b720e20e0edc8672533c5de 100644 --- a/app/models/project_services/hipchat_service.rb +++ b/app/models/project_services/hipchat_service.rb @@ -57,11 +57,15 @@ def create_message(push) message = "" message << "#{push[:user_name]} " if before =~ /000000/ - message << "pushed new branch <a href=\"#{project.web_url}/commits/#{ref}\">#{ref}</a> to <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a>\n" + message << "pushed new branch <a href=\""\ + "#{project.web_url}/commits/#{URI.escape(ref)}\">#{ref}</a>"\ + " to <a href=\"#{project.web_url}\">"\ + "#{project.name_with_namespace.gsub!(/\s/, "")}</a>\n" elsif after =~ /000000/ message << "removed branch #{ref} from <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a> \n" else - message << "pushed to branch <a href=\"#{project.web_url}/commits/#{ref}\">#{ref}</a> " + message << "pushed to branch <a href=\""\ + "#{project.web_url}/commits/#{URI.escape(ref)}\">#{ref}</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>)" for commit in push[:commits] do