comparison app/controllers/application_controller.rb @ 474:dff13616e464 feature_125

Avoid double-slash in path
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Mon, 27 Jun 2011 12:37:09 +0100
parents 7d8567890fa3
children 32dd9e02950a
comparison
equal deleted inserted replaced
365:7d8567890fa3 474:dff13616e464
264 # do not redirect user to another host or to the login or register page 264 # do not redirect user to another host or to the login or register page
265 if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)}) 265 if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
266 # soundsoftware: if back_url is the home page, 266 # soundsoftware: if back_url is the home page,
267 # change it to My Page (#125) 267 # change it to My Page (#125)
268 if (uri.path == home_path) 268 if (uri.path == home_path)
269 uri.path = uri.path + "/my" 269 if (uri.path =~ /\/$/)
270 uri.path = uri.path + "my"
271 else
272 uri.path = uri.path + "/my"
273 end
270 end 274 end
271 # soundsoftware: if login page is https but back_url http, 275 # soundsoftware: if login page is https but back_url http,
272 # switch back_url to https to ensure cookie validity (#83) 276 # switch back_url to https to ensure cookie validity (#83)
273 if (uri.scheme == "http") && (URI.parse(request.url).scheme == "https") 277 if (uri.scheme == "http") && (URI.parse(request.url).scheme == "https")
274 uri.scheme = "https" 278 uri.scheme = "https"