From cbd120bb72b1e2339b71f90eeef5b88bbecc3d4a Mon Sep 17 00:00:00 2001 From: Jonathan Stott Date: Fri, 30 Mar 2012 22:28:45 +0100 Subject: [PATCH] Refactor logic on not_found/etag --- lib/sinatra/simple_assets.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/sinatra/simple_assets.rb b/lib/sinatra/simple_assets.rb index b3cd97c..e54f5b0 100644 --- a/lib/sinatra/simple_assets.rb +++ b/lib/sinatra/simple_assets.rb @@ -30,10 +30,12 @@ def self.registered(app) ].each do |r| app.get "#{r[:route]}/:bundle" do |bundle| assets = settings.assets - exists = assets.bundle_exists?(bundle) - etag bundle if exists - not_found unless exists + if assets.bundle_exists?(bundle) + etag bundle + else + not_found + end cache_control :public, :max_age => 2592000 # one month