summaryrefslogtreecommitdiff
path: root/app/models/application_setting.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-05 09:08:56 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-05 09:08:56 +0000
commit258cd2409347baa19566d8bf34207521c142d8b7 (patch)
treea3c7bb6cdc354abd647e223148c1d6b8b432cde8 /app/models/application_setting.rb
parent962fbcfb94b13668632de822e3f7a74fb5ecaf68 (diff)
downloadgitlab-ce-258cd2409347baa19566d8bf34207521c142d8b7.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/application_setting.rb')
-rw-r--r--app/models/application_setting.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index 8c599b6adec..c4b6bcb9395 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -573,6 +573,7 @@ class ApplicationSetting < ApplicationRecord
before_validation :ensure_uuid!
before_validation :coerce_repository_storages_weighted, if: :repository_storages_weighted_changed?
+ before_validation :sanitize_default_branch_name
before_save :ensure_runners_registration_token
before_save :ensure_health_check_access_token
@@ -602,6 +603,14 @@ class ApplicationSetting < ApplicationRecord
!!(sourcegraph_url =~ %r{\Ahttps://(www\.)?sourcegraph\.com})
end
+ def sanitize_default_branch_name
+ self.default_branch_name = if default_branch_name.blank?
+ nil
+ else
+ Sanitize.fragment(self.default_branch_name)
+ end
+ end
+
def instance_review_permitted?
users_count = Rails.cache.fetch('limited_users_count', expires_in: 1.day) do
::User.limit(INSTANCE_REVIEW_MIN_USERS + 1).count(:all)