support for svgz gzip
This commit is contained in:
parent
4cfbd6e5d9
commit
7ab8f0cdd1
BIN
fixtures/test-app/source/images/cfb_tomb-perennial-energy.svgz
Normal file
BIN
fixtures/test-app/source/images/cfb_tomb-perennial-energy.svgz
Normal file
Binary file not shown.
|
@ -1,6 +1,7 @@
|
||||||
%h1 Welcome
|
%h1 Welcome
|
||||||
|
|
||||||
= image_tag "Chrome_Logo.svg"
|
= image_tag "Chrome_Logo.svg"
|
||||||
|
= image_tag "cfb_tomb-perennial-energy.svgz"
|
||||||
|
|
||||||
:markdown
|
:markdown
|
||||||
## H2
|
## H2
|
||||||
|
|
|
@ -432,13 +432,16 @@ protected
|
||||||
#
|
#
|
||||||
# @param [String] File to send
|
# @param [String] File to send
|
||||||
def send_file(path)
|
def send_file(path)
|
||||||
matched_mime = mime_type(File.extname(path))
|
extension = File.extname(path)
|
||||||
|
matched_mime = mime_type(extension)
|
||||||
matched_mime = "application/octet-stream" if matched_mime.nil?
|
matched_mime = "application/octet-stream" if matched_mime.nil?
|
||||||
content_type matched_mime
|
content_type matched_mime
|
||||||
|
|
||||||
file = ::Rack::File.new nil
|
file = ::Rack::File.new nil
|
||||||
file.path = path
|
file.path = path
|
||||||
halt file.serving(env)
|
response = file.serving(env)
|
||||||
|
response[1]['Content-Encoding'] = 'gzip' if %w(.svgz).include?(extension)
|
||||||
|
halt response
|
||||||
end
|
end
|
||||||
|
|
||||||
# Set the content type for the current request
|
# Set the content type for the current request
|
||||||
|
|
Loading…
Reference in a new issue