diff --git a/fixtures/test-app/source/images/cfb_tomb-perennial-energy.svgz b/fixtures/test-app/source/images/cfb_tomb-perennial-energy.svgz new file mode 100644 index 00000000..e2eb29ec Binary files /dev/null and b/fixtures/test-app/source/images/cfb_tomb-perennial-energy.svgz differ diff --git a/fixtures/test-app/source/index.html.haml b/fixtures/test-app/source/index.html.haml index e4ac5057..221c0134 100755 --- a/fixtures/test-app/source/index.html.haml +++ b/fixtures/test-app/source/index.html.haml @@ -1,6 +1,7 @@ %h1 Welcome = image_tag "Chrome_Logo.svg" += image_tag "cfb_tomb-perennial-energy.svgz" :markdown ## H2 diff --git a/lib/middleman/base.rb b/lib/middleman/base.rb index 2996e726..57adc78d 100644 --- a/lib/middleman/base.rb +++ b/lib/middleman/base.rb @@ -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