# HG changeset patch # User edogawaconan # Date 1396722010 -32400 # Node ID fec39456dcbe7f286155f031b9d7917d531a0158 # Parent 612bc7c32324786ad2e4314ff5d2643a55f4c19e Better request format checker. Didn't quite work when using curl. diff -r 612bc7c32324 -r fec39456dcbe app/controllers/pastes_controller.rb --- a/app/controllers/pastes_controller.rb Sun Apr 06 03:04:43 2014 +0900 +++ b/app/controllers/pastes_controller.rb Sun Apr 06 03:20:10 2014 +0900 @@ -72,11 +72,11 @@ correct_path == request.fullpath end - def cache_key(format = request.format) + def cache_key(format = request.format.symbol) ext = case format - when Mime::TXT + when :txt ".txt" - when Mime::HTML + when :html, nil "" else ".unknown" @@ -91,7 +91,7 @@ end def uncache - [Mime::TXT, Mime::HTML, "others"].each do |format| + [:txt, :html, :unknown].each do |format| Rails.cache.delete cache_key(format) end end