Files
mapknitter/app/controllers/utility_controller.rb
Jeffrey Warren bc7a4594e7 Adjust TMS redirects for google cloud, new route redirect style (#1548)
* Adjust TMS redirects for google cloud, new route redirect style

* Update utility_controller.rb

* Apply suggestions from code review

* Update _cloud_exports.html.erb

* Update tms_info.html.erb

* Delete utility_controller_test.rb

* Update routes.rb

* Update utility_controller.rb

* Update app/controllers/utility_controller.rb

* Update utility_controller.rb

* Update .codecov.yml

* Update _cloud_exports.html.erb
2021-11-03 15:49:41 -04:00

12 lines
597 B
Ruby

class UtilityController < ApplicationController
# TMS redirects now handled mostly in config/routes.rb
# most export TMS routes are handled in app/views/maps/_cloud_exports.html.erb, but this may catch some too
# if no static local file exists in format /tms/:id/:z/:x/:y.png, this action handles the request
def tms
unless Map.find_by(slug: params[:id]) # if no map with the given slug is found, record_not_found is thrown
redirect_to("https://mapknitter-exports-warps.storage.googleapis.com/#{params[:id]}/tms/#{params[:z]}/#{params[:x]}/#{params[:y]}.png")
end
end
end