Skip to content

Commit

Permalink
Better swift redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Jul 22, 2016
1 parent 2af8c3d commit 263d5e2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,17 @@
get '/rails/mailers/*path' => "rails/mailers#preview"
end

# legacy swift rename redirects
get '/swift/', to: redirect("/SwiftPM")
get '/Swift/', to: redirect("/SwiftPM")

get '/swift/:name', to: redirect("/SwiftPM/%{name}"), constraints: { :name => /.*/ }
get '/Swift/:name', to: redirect("/SwiftPM/%{name}"), constraints: { :name => /.*/ }
get '/swift/:name', constraints: { :name => /.*/ }, to: redirect { |params, request|
path = "SwiftPM/#{Rack::Utils.escape(params[:name])}"
"http://#{request.host_with_port}/#{path}"
}
get '/swift/:name', constraints: { :name => /.*/ }, to: redirect { |params, request|
path = "SwiftPM/#{Rack::Utils.escape(params[:name])}"
"http://#{request.host_with_port}/#{path}"
}

get '/:platform/:name/suggestions', to: 'project_suggestions#new', as: :project_suggestions, constraints: { :name => /.*/ }
post '/:platform/:name/suggestions', to: 'project_suggestions#create', constraints: { :name => /.*/ }
Expand Down

0 comments on commit 263d5e2

Please sign in to comment.