mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Fallback to gzip compression if brotli isn't supported (#7895)
This commit is contained in:
committed by
Rafael dos Santos Silva
parent
7890f10693
commit
eff1c19e3b
@@ -58,6 +58,10 @@ module ApplicationHelper
|
||||
request.env["HTTP_ACCEPT_ENCODING"] =~ /br/
|
||||
end
|
||||
|
||||
def is_gzip_req?
|
||||
request.env["HTTP_ACCEPT_ENCODING"] =~ /gzip/
|
||||
end
|
||||
|
||||
def script_asset_path(script)
|
||||
path = asset_path("#{script}.js")
|
||||
|
||||
@@ -77,6 +81,8 @@ module ApplicationHelper
|
||||
|
||||
if is_brotli_req?
|
||||
path = path.gsub(/\.([^.]+)$/, '.br.\1')
|
||||
elsif is_gzip_req?
|
||||
path = path.gsub(/\.([^.]+)$/, '.gz.\1')
|
||||
end
|
||||
|
||||
elsif GlobalSetting.cdn_url&.start_with?("https") && is_brotli_req?
|
||||
|
||||
Reference in New Issue
Block a user