From: Julien Lancelot Date: Wed, 27 Aug 2014 10:43:58 +0000 (+0200) Subject: SONAR-5540 Dashboard links are broken if apache does not allow to encode slash in URL X-Git-Tag: 4.5-RC1~76 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3dd1cb53730e72ee99b20ff921fa1b7ff6ce5506;p=sonarqube.git SONAR-5540 Dashboard links are broken if apache does not allow to encode slash in URL --- diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb index 5ea88ea1f96..18649eeb084 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb @@ -302,6 +302,7 @@ module ApplicationHelper end + # # # link to the current page with the given resource. If file, then open a popup to display resource viewers. @@ -312,18 +313,29 @@ module ApplicationHelper period_index=nil if period_index && period_index<=0 if resource.display_dashboard? if options[:dashboard] - link_to(name || resource.name, params.merge({:controller => 'dashboard', :action => 'index', :id => resource.id, :period => period_index, - :tab => options[:tab], :rule => options[:rule]}), :title => options[:title], :class => options[:class]) + url = "#{ApplicationController.root_context}/dashboard/index?id=#{u resource.id}" + url += "&period=#{u period_index}" if period_index + url += "&tab=#{u options[:tab]}" if options[:tab] + url += "&rule=#{u options[:rule]}" if options[:rule] + "#{name || resource.name}" else # stay on the same page (for example components) - link_to(name || resource.name, params.merge({:id => resource.id, :period => period_index, :tab => options[:tab], :rule => options[:rule]}), :title => options[:title], :class => options[:class]) + url = "#{ApplicationController.root_context}/#{u params[:controller]}/#{u params[:action]}?id=#{u resource.id}" + url += "&period=#{u period_index}" if period_index + url += "&tab=#{u options[:tab]}" if options[:tab] + url += "&rule=#{u options[:rule]}" if options[:rule] + "#{name || resource.name}" end else - if options[:line] - anchor= 'L' + options[:line].to_s - end - link_to(name || resource.name, {:controller => 'dashboard', :action => 'index', :anchor => anchor, :id => resource.key, :period => period_index, :tab => options[:tab], :rule => options[:rule], - :metric => options[:metric]}, :popup => ["resource-#{resource.key.parameterize}", ''], :title => options[:title], :class => options[:class]) + url = "#{ApplicationController.root_context}/dashboard/index?id=#{u resource.key}" + url += "&period=#{u period_index}" if period_index + url += "&tab=#{u options[:tab]}" if options[:tab] + url += "&rule=#{u options[:rule]}" if options[:rule] + url += "&metric=#{u options[:metric]}" if options[:metric] + url += '#L' + options[:line].to_s if options[:line] + "#{name || resource.name}" end end