summaryrefslogtreecommitdiff
path: root/config/routes/uploads.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-10-05 15:21:27 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-10-05 15:21:27 +0300
commitf223a41660f1a629614d3d559468b1a5488b96d8 (patch)
treef253bba0103d951980811f0563bc7c07657d2fdc /config/routes/uploads.rb
parent3fd5ea3d4362e6946f8502bb30825cc14013b374 (diff)
downloadgitlab-ce-f223a41660f1a629614d3d559468b1a5488b96d8.tar.gz
Split routes on multiple filesdz-split-routes
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'config/routes/uploads.rb')
-rw-r--r--config/routes/uploads.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/config/routes/uploads.rb b/config/routes/uploads.rb
new file mode 100644
index 00000000000..2b22148a134
--- /dev/null
+++ b/config/routes/uploads.rb
@@ -0,0 +1,21 @@
+scope path: :uploads do
+ # Note attachments and User/Group/Project avatars
+ get ":model/:mounted_as/:id/:filename",
+ to: "uploads#show",
+ constraints: { model: /note|user|group|project/, mounted_as: /avatar|attachment/, filename: /[^\/]+/ }
+
+ # Appearance
+ get ":model/:mounted_as/:id/:filename",
+ to: "uploads#show",
+ constraints: { model: /appearance/, mounted_as: /logo|header_logo/, filename: /.+/ }
+
+ # Project markdown uploads
+ get ":namespace_id/:project_id/:secret/:filename",
+ to: "projects/uploads#show",
+ constraints: { namespace_id: /[a-zA-Z.0-9_\-]+/, project_id: /[a-zA-Z.0-9_\-]+/, filename: /[^\/]+/ }
+end
+
+# Redirect old note attachments path to new uploads path.
+get "files/note/:id/:filename",
+ to: redirect("uploads/note/attachment/%{id}/%{filename}"),
+ constraints: { filename: /[^\/]+/ }