Skip to content

Commit

Permalink
Refactor logic on not_found/etag
Browse files Browse the repository at this point in the history
  • Loading branch information
namelessjon committed Mar 30, 2012
1 parent f6e0d45 commit cbd120b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/sinatra/simple_assets.rb
Expand Up @@ -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

Expand Down

0 comments on commit cbd120b

Please sign in to comment.