From 5a2aa06a512bd0f7e1ce7138ca5171d116158cf4 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Sun, 30 Apr 2023 00:47:50 -0400 Subject: [PATCH] Fix Rails/Present cop (#24688) --- .rubocop_todo.yml | 6 ------ config/initializers/content_security_policy.rb | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 4da60ee240..b68d406601 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1399,12 +1399,6 @@ Rails/OutputSafety: Exclude: - 'config/initializers/simple_form.rb' -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: NotNilAndNotEmpty, NotBlank, UnlessBlank. -Rails/Present: - Exclude: - - 'config/initializers/content_security_policy.rb' - # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Include. # Include: **/Rakefile, **/*.rake diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 96026ce3b7..f4f9177996 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -3,7 +3,7 @@ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy def host_to_url(str) - "http#{Rails.configuration.x.use_https ? 's' : ''}://#{str}" unless str.blank? + "http#{Rails.configuration.x.use_https ? 's' : ''}://#{str}" if str.present? end base_host = Rails.configuration.x.web_domain