X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/45abfe49e1a27c302277e2f9f279cedf4f073439..fafed5f82159141b724dd517facb561d305bb9b1:/app/controllers/application_controller.rb?ds=inline diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 25c430f1c..f6006fe5e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -114,7 +114,7 @@ class ApplicationController < ActionController::Base def check_database_writable(need_api: false) if Settings.status == "database_offline" || Settings.status == "database_readonly" || - (need_api && (Settings.status == "api_offline" || Settings.status == "api_readonly")) + (need_api && %w[api_offline api_readonly].include?(Settings.status)) if request.xhr? report_error "Database offline for maintenance", :service_unavailable else @@ -339,7 +339,7 @@ class ApplicationController < ActionController::Base begin referer = URI.parse(referer) - if referer.scheme == "http" || referer.scheme == "https" + if %w[http https].include?(referer.scheme) referer.scheme = nil referer.host = nil referer.port = nil