From 452ba19cdd8e61fa568e2f6462c14b8f31c4c07b Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Sat, 21 Feb 2015 10:58:11 +0100 Subject: Change check to only swap static middleware when it's enabled. --- config/initializers/static_files.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/config/initializers/static_files.rb b/config/initializers/static_files.rb index bc4fe14bc1a..d9042c652bb 100644 --- a/config/initializers/static_files.rb +++ b/config/initializers/static_files.rb @@ -1,6 +1,6 @@ -begin - app = Rails.application +app = Rails.application +if app.config.serve_static_assets # The `ActionDispatch::Static` middleware intercepts requests for static files # by checking if they exist in the `/public` directory. # We're replacing it with our `Gitlab::Middleware::Static` that does the same, @@ -12,7 +12,4 @@ begin app.paths["public"].first, app.config.static_cache_control ) -rescue - # If ActionDispatch::Static wasn't loaded onto the stack (like in production), - # an exception is raised. end -- cgit v1.2.1