support for svgz gzip
This commit is contained in:
parent
4cfbd6e5d9
commit
7ab8f0cdd1
3 changed files with 6 additions and 2 deletions
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
|
||||
|
||||
= image_tag "Chrome_Logo.svg"
|
||||
= image_tag "cfb_tomb-perennial-energy.svgz"
|
||||
|
||||
:markdown
|
||||
## H2
|
||||
|
|
|
@ -432,13 +432,16 @@ protected
|
|||
#
|
||||
# @param [String] File to send
|
||||
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?
|
||||
content_type matched_mime
|
||||
|
||||
file = ::Rack::File.new nil
|
||||
file.path = path
|
||||
halt file.serving(env)
|
||||
response = file.serving(env)
|
||||
response[1]['Content-Encoding'] = 'gzip' if %w(.svgz).include?(extension)
|
||||
halt response
|
||||
end
|
||||
|
||||
# Set the content type for the current request
|
||||
|
|
Loading…
Reference in a new issue