summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-12-17 11:02:17 +0000
committerRémy Coutable <remy@rymai.me>2018-12-17 11:02:17 +0000
commit32b6129d8cef406b1cafa455fcf0bf83ddba46de (patch)
treec3b11f9f7aec8ced342a5d5868bb203dfe12569b /app/controllers
parent9072516f8a5b4298175dbea4d62fcf6203297337 (diff)
parent56296f1edadf2bc5f7741cbb3f97cb41f090aac6 (diff)
downloadgitlab-ce-32b6129d8cef406b1cafa455fcf0bf83ddba46de.tar.gz
Merge branch 'remove-rails4-specific-code' into 'master'
Remove rails4 specific code See merge request gitlab-org/gitlab-ce!23847
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/application_controller.rb5
-rw-r--r--app/controllers/concerns/invalid_utf8_error_handler.rb27
2 files changed, 1 insertions, 31 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 7c8c1392c1c..6f0dc2a3a20 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -12,9 +12,6 @@ class ApplicationController < ActionController::Base
include EnforcesTwoFactorAuthentication
include WithPerformanceBar
include SessionlessAuthentication
- # this can be removed after switching to rails 5
- # https://gitlab.com/gitlab-org/gitlab-ce/issues/51908
- include InvalidUTF8ErrorHandler unless Gitlab.rails5?
before_action :authenticate_user!
before_action :enforce_terms!, if: :should_enforce_terms?
@@ -157,7 +154,7 @@ class ApplicationController < ActionController::Base
def log_exception(exception)
Gitlab::Sentry.track_acceptable_exception(exception)
- backtrace_cleaner = Gitlab.rails5? ? request.env["action_dispatch.backtrace_cleaner"] : env
+ backtrace_cleaner = request.env["action_dispatch.backtrace_cleaner"]
application_trace = ActionDispatch::ExceptionWrapper.new(backtrace_cleaner, exception).application_trace
application_trace.map! { |t| " #{t}\n" }
logger.error "\n#{exception.class.name} (#{exception.message}):\n#{application_trace.join}"
diff --git a/app/controllers/concerns/invalid_utf8_error_handler.rb b/app/controllers/concerns/invalid_utf8_error_handler.rb
deleted file mode 100644
index 44c6d6b0da0..00000000000
--- a/app/controllers/concerns/invalid_utf8_error_handler.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-module InvalidUTF8ErrorHandler
- extend ActiveSupport::Concern
-
- included do
- rescue_from ArgumentError, with: :handle_invalid_utf8
- end
-
- private
-
- def handle_invalid_utf8(error)
- if error.message == "invalid byte sequence in UTF-8"
- render_412
- else
- raise(error)
- end
- end
-
- def render_412
- respond_to do |format|
- format.html { render "errors/precondition_failed", layout: "errors", status: 412 }
- format.js { render json: { error: 'Invalid UTF-8' }, status: :precondition_failed, content_type: 'application/json' }
- format.any { head :precondition_failed }
- end
- end
-end