Commit 980303b5 authored by dineshpanda's avatar dineshpanda

Avoid calling freeze on already frozen strings in app/controllers

parent dc864927
...@@ -47,8 +47,8 @@ class ApplicationController < ActionController::Base ...@@ -47,8 +47,8 @@ class ApplicationController < ActionController::Base
# Adds `no-store` to the DEFAULT_CACHE_CONTROL, to prevent security # Adds `no-store` to the DEFAULT_CACHE_CONTROL, to prevent security
# concerns due to caching private data. # concerns due to caching private data.
DEFAULT_GITLAB_CACHE_CONTROL = "#{ActionDispatch::Http::Cache::Response::DEFAULT_CACHE_CONTROL}, no-store".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".freeze DEFAULT_GITLAB_CONTROL_NO_CACHE = "#{DEFAULT_GITLAB_CACHE_CONTROL}, no-cache"
rescue_from Encoding::CompatibilityError do |exception| rescue_from Encoding::CompatibilityError do |exception|
log_exception(exception) log_exception(exception)
...@@ -143,7 +143,7 @@ class ApplicationController < ActionController::Base ...@@ -143,7 +143,7 @@ class ApplicationController < ActionController::Base
payload[:username] = logged_user.try(:username) payload[:username] = logged_user.try(:username)
end 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 payload[:response] = response.body
end end
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
module LfsRequest module LfsRequest
extend ActiveSupport::Concern extend ActiveSupport::Concern
CONTENT_TYPE = 'application/vnd.git-lfs+json'.freeze CONTENT_TYPE = 'application/vnd.git-lfs+json'
included do included do
before_action :require_lfs_enabled! before_action :require_lfs_enabled!
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
class Projects::LfsApiController < Projects::GitHttpClientController class Projects::LfsApiController < Projects::GitHttpClientController
include LfsRequest 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] skip_before_action :lfs_check_access!, only: [:deprecated]
before_action :lfs_check_batch_operation!, only: [:batch] before_action :lfs_check_batch_operation!, only: [:batch]
......
...@@ -40,7 +40,7 @@ class SessionsController < Devise::SessionsController ...@@ -40,7 +40,7 @@ class SessionsController < Devise::SessionsController
# token mismatch. # token mismatch.
protect_from_forgery with: :exception, prepend: true 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 MAX_FAILED_LOGIN_ATTEMPTS = 5
def new def new
...@@ -111,14 +111,14 @@ class SessionsController < Devise::SessionsController ...@@ -111,14 +111,14 @@ class SessionsController < Devise::SessionsController
def increment_failed_login_captcha_counter def increment_failed_login_captcha_counter
Gitlab::Metrics.counter( Gitlab::Metrics.counter(
:failed_login_captcha_total, :failed_login_captcha_total,
'Number of failed CAPTCHA attempts for logins'.freeze 'Number of failed CAPTCHA attempts for logins'
).increment ).increment
end end
def increment_successful_login_captcha_counter def increment_successful_login_captcha_counter
Gitlab::Metrics.counter( Gitlab::Metrics.counter(
:successful_login_captcha_total, :successful_login_captcha_total,
'Number of successful CAPTCHA attempts for logins'.freeze 'Number of successful CAPTCHA attempts for logins'
).increment ).increment
end 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