summaryrefslogtreecommitdiff
path: root/app/models/application_setting.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-09-12 05:55:29 -0700
committerStan Hu <stanhu@gmail.com>2018-09-12 13:29:33 -0700
commit775081ba56baf473f580437d4b6ea2d7b8a39c43 (patch)
tree28782396a01445b117595a4d043291d6ba14f165 /app/models/application_setting.rb
parentfb81210ba7079ede4451d979b8da92fcdf04a17c (diff)
downloadgitlab-ce-775081ba56baf473f580437d4b6ea2d7b8a39c43.tar.gz
Strip whitespace from Sentry URL
Adding extra whitespace in the DSN could prevent the server from starting due to InvalidURIErrors in sentry-raven. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/49621
Diffstat (limited to 'app/models/application_setting.rb')
-rw-r--r--app/models/application_setting.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index d8536c5512d..645adddb000 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -219,6 +219,7 @@ class ApplicationSetting < ActiveRecord::Base
validate :terms_exist, if: :enforce_terms?
before_validation :ensure_uuid!
+ before_validation :strip_sentry_values
before_save :ensure_runners_registration_token
before_save :ensure_health_check_access_token
@@ -382,6 +383,11 @@ class ApplicationSetting < ActiveRecord::Base
super(levels.map { |level| Gitlab::VisibilityLevel.level_value(level) })
end
+ def strip_sentry_values
+ sentry_dsn.strip! if sentry_dsn.present?
+ clientside_sentry_dsn.strip! if clientside_sentry_dsn.present?
+ end
+
def performance_bar_allowed_group
Group.find_by_id(performance_bar_allowed_group_id)
end