A platform for community discussion. Free, open, simple.
DEV: Load SVG sprites during system spec runs (#19497)
Penar Musaraj8546c2084acc
diff --git a/lib/discourse.rb b/lib/discourse.rbindex 1773d4e3054..68c2e6f2104 100644--- a/lib/discourse.rb+++ b/lib/discourse.rb@@ -498,16 +498,20 @@ module DiscourseSiteSetting.force_https? ? "https" : "http"end- def self.base_url_no_prefix+ def self.current_hostname_with_portdefault_port = SiteSetting.force_https? ? 443 : 80- url = +"#{base_protocol}://#{current_hostname}"- url << ":#{SiteSetting.port}" if SiteSetting.port.to_i > 0 && SiteSetting.port.to_i != default_port+ result = +"#{current_hostname}"+ result << ":#{SiteSetting.port}" if SiteSetting.port.to_i > 0 && SiteSetting.port.to_i != default_portif Rails.env.development? && SiteSetting.port.blank?- url << ":#{ENV["UNICORN_PORT"] || 3000}"+ result << ":#{ENV["UNICORN_PORT"] || 3000}"end- url+ result+ end++ def self.base_url_no_prefix+ "#{base_protocol}://#{current_hostname_with_port}"enddef self.base_urldiff --git a/lib/middleware/enforce_hostname.rb b/lib/middleware/enforce_hostname.rbindex 486753c7d7f..44ac8d7d4a1 100644--- a/lib/middleware/enforce_hostname.rb+++ b/lib/middleware/enforce_hostname.rb@@ -18,7 +18,7 @@ module Middlewarerequested_hostname = env[Rack::HTTP_HOST]env[Discourse::REQUESTED_HOSTNAME] = requested_hostname- env[Rack::HTTP_HOST] = allowed_hostnames.find { |h| h == requested_hostname } || Discourse.current_hostname+ env[Rack::HTTP_HOST] = allowed_hostnames.find { |h| h == requested_hostname } || Discourse.current_hostname_with_port@app.call(env)enddiff --git a/spec/support/system_helpers.rb b/spec/support/system_helpers.rbindex 6677d1a168b..ee9faba604b 100644--- a/spec/support/system_helpers.rb+++ b/spec/support/system_helpers.rb@@ -22,7 +22,8 @@ module SystemHelpersdef setup_system_testSiteSetting.login_required = falseSiteSetting.content_security_policy = false- SiteSetting.force_hostname = "#{Capybara.server_host}:#{Capybara.server_port}"+ SiteSetting.force_hostname = Capybara.server_host+ SiteSetting.port = Capybara.server_portSiteSetting.external_system_avatars_enabled = falseend