Guest User

Untitled

a guest
Oct 19th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. require 'action_dispatch/middleware/static'
  2.  
  3. ActionDispatch::FileHandler.class_eval do
  4. private
  5.  
  6. def gzip_file_path(path)
  7. return false if ['image/png', 'image/jpeg', 'image/gif'].include? content_type(path)
  8. gzip_path = "#{path}.gz"
  9. if File.exist?(File.join(@root, ::Rack::Utils.unescape_path(gzip_path)))
  10. gzip_path
  11. else
  12. false
  13. end
  14. end
  15. end
Add Comment
Please, Sign In to add comment