summaryrefslogtreecommitdiff
path: root/config/initializers/static_files.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-02-20 12:44:07 +0100
committerDouwe Maan <douwe@gitlab.com>2015-02-20 12:44:07 +0100
commit4310431ee73fdd6aa3874aaccc0a901252e7f61f (patch)
tree97065a9c0862ccd467b3f8e6789922731b68804f /config/initializers/static_files.rb
parenteb210f4a1876f0dbf70b8c3ae855b6a986777421 (diff)
downloadgitlab-ce-4310431ee73fdd6aa3874aaccc0a901252e7f61f.tar.gz
Use modified ActionDispatch::Static to let uploads go through to routes.
Diffstat (limited to 'config/initializers/static_files.rb')
-rw-r--r--config/initializers/static_files.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/config/initializers/static_files.rb b/config/initializers/static_files.rb
new file mode 100644
index 00000000000..e04c29cee4a
--- /dev/null
+++ b/config/initializers/static_files.rb
@@ -0,0 +1,13 @@
+begin
+ app = Rails.application
+
+ app.config.middleware.swap(
+ ActionDispatch::Static,
+ Gitlab::Middleware::Static,
+ 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 \ No newline at end of file