Commit 72d39e3d authored by Stan Hu's avatar Stan Hu

Merge branch 'remove-unnecessary-freeze-in-app-controllers' into 'master'

Avoid calling freeze on already frozen strings in app/controllers

See merge request gitlab-org/gitlab-ce!32498
parents a8a10a00 980303b5
......@@ -47,8 +47,8 @@ class ApplicationController < ActionController::Base
# Adds `no-store` to the DEFAULT_CACHE_CONTROL, to prevent security
# concerns due to caching private data.
DEFAULT_GITLAB_CACHE_CONTROL = "#{ActionDispatch::Http::Cache::Response::DEFAULT_CACHE_CONTROL}, no-store".freeze
DEFAULT_GITLAB_CONTROL_NO_CACHE = "#{DEFAULT_GITLAB_CACHE_CONTROL}, no-cache".freeze
DEFAULT_GITLAB_CACHE_CONTROL = "#{ActionDispatch::Http::Cache::Response::DEFAULT_CACHE_CONTROL}, no-store"
DEFAULT_GITLAB_CONTROL_NO_CACHE = "#{DEFAULT_GITLAB_CACHE_CONTROL}, no-cache"
rescue_from Encoding::CompatibilityError do |exception|
log_exception(exception)
......@@ -143,7 +143,7 @@ class ApplicationController < ActionController::Base
payload[:username] = logged_user.try(:username)
end
if response.status == 422 && response.body.present? && response.content_type == 'application/json'.freeze
if response.status == 422 && response.body.present? && response.content_type == 'application/json'
payload[:response] = response.body
end
......
......@@ -12,7 +12,7 @@
module LfsRequest
extend ActiveSupport::Concern
CONTENT_TYPE = 'application/vnd.git-lfs+json'.freeze
CONTENT_TYPE = 'application/vnd.git-lfs+json'
included do
before_action :require_lfs_enabled!
......
......@@ -3,7 +3,7 @@
class Projects::LfsApiController < Projects::GitHttpClientController
include LfsRequest
LFS_TRANSFER_CONTENT_TYPE = 'application/octet-stream'.freeze
LFS_TRANSFER_CONTENT_TYPE = 'application/octet-stream'
skip_before_action :lfs_check_access!, only: [:deprecated]
before_action :lfs_check_batch_operation!, only: [:batch]
......
......@@ -40,7 +40,7 @@ class SessionsController < Devise::SessionsController
# token mismatch.
protect_from_forgery with: :exception, prepend: true
CAPTCHA_HEADER = 'X-GitLab-Show-Login-Captcha'.freeze
CAPTCHA_HEADER = 'X-GitLab-Show-Login-Captcha'
MAX_FAILED_LOGIN_ATTEMPTS = 5
def new
......@@ -111,14 +111,14 @@ class SessionsController < Devise::SessionsController
def increment_failed_login_captcha_counter
Gitlab::Metrics.counter(
:failed_login_captcha_total,
'Number of failed CAPTCHA attempts for logins'.freeze
'Number of failed CAPTCHA attempts for logins'
).increment
end
def increment_successful_login_captcha_counter
Gitlab::Metrics.counter(
:successful_login_captcha_total,
'Number of successful CAPTCHA attempts for logins'.freeze
'Number of successful CAPTCHA attempts for logins'
).increment
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment