summaryrefslogtreecommitdiffstats
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-08-26 10:40:09 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-08-26 10:40:09 +0000
commitebc979e9b1b70bab7bce5079ab7d19b333274514 (patch)
treee38055d167282b5302062491086dc21c9c95d4f7 /app/controllers/application_controller.rb
parent3cc6d5e8159673a3336b5cdb26f27b07a7fea326 (diff)
downloadredmine-ebc979e9b1b70bab7bce5079ab7d19b333274514.tar.gz
redmine-ebc979e9b1b70bab7bce5079ab7d19b333274514.zip
Do not use escaped back_url param (#11691).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10239 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index d6efa4124..aacb8e523 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -296,12 +296,16 @@ class ApplicationController < ActionController::Base
end
def back_url
- params[:back_url] || request.env['HTTP_REFERER']
+ url = params[:back_url]
+ if url.nil? && referer = request.env['HTTP_REFERER']
+ url = CGI.unescape(referer.to_s)
+ end
+ url
end
def redirect_back_or_default(default)
- back_url = CGI.unescape(params[:back_url].to_s)
- if !back_url.blank?
+ back_url = params[:back_url].to_s
+ if back_url.present?
begin
uri = URI.parse(back_url)
# do not redirect user to another host or to the login or register page
@@ -310,6 +314,7 @@ class ApplicationController < ActionController::Base
return
end
rescue URI::InvalidURIError
+ logger.warn("Could not redirect to invalid URL #{back_url}")
# redirect to default
end
end