Project

General

Profile

Patch #9096 ยป uri_parse_workaround.diff

Kirill Smirnov, 2011-08-22 01:06

View differences:

app/controllers/application_controller.rb (working copy)
back_url = CGI.unescape(params[:back_url].to_s)
if !back_url.blank?
begin
uri = URI.parse(back_url)
# Workaround for ruby bug #21314: Uri parser not accepting non-Latin characters
uri = URI.parse(URI.escape(back_url))
# do not redirect user to another host or to the login or register page
if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
redirect_to(back_url)
    (1-1/1)