uri_parse_workaround.diff

Kirill Smirnov, 2011-08-22 01:06

Download (743 Bytes)

View differences:

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