gitlab-org--gitlab-foss/config/routes/uploads.rb

43 lines
1.6 KiB
Ruby
Raw Normal View History

scope path: :uploads do
# Note attachments and User/Group/Project avatars
2017-07-17 03:16:33 -04:00
get "-/system/:model/:mounted_as/:id/:filename",
to: "uploads#show",
2018-01-27 00:35:53 -05:00
constraints: { model: /note|user|group|project/, mounted_as: /avatar|attachment/, filename: %r{[^/]+} }
# show uploads for models, snippets (notes) available for now
get '-/system/:model/:id/:secret/:filename',
to: 'uploads#show',
constraints: { model: /personal_snippet|user/, id: /\d+/, filename: %r{[^/]+} }
# show temporary uploads
get '-/system/temp/:secret/:filename',
to: 'uploads#show',
2018-01-27 00:35:53 -05:00
constraints: { filename: %r{[^/]+} }
# Appearance
2017-07-17 03:16:33 -04:00
get "-/system/:model/:mounted_as/:id/:filename",
to: "uploads#show",
constraints: { model: /appearance/, mounted_as: /logo|header_logo|favicon/, filename: /.+/ },
as: 'appearance_upload'
# Project markdown uploads
get ":namespace_id/:project_id/:secret/:filename",
to: "projects/uploads#show",
2018-01-27 00:35:53 -05:00
constraints: { namespace_id: /[a-zA-Z.0-9_\-]+/, project_id: /[a-zA-Z.0-9_\-]+/, filename: %r{[^/]+} }
# create uploads for models, snippets (notes) available for now
2017-05-03 11:26:49 -04:00
post ':model',
to: 'uploads#create',
constraints: { model: /personal_snippet|user/, id: /\d+/ },
as: 'upload'
post ':model/authorize',
to: 'uploads#authorize',
constraints: { model: /personal_snippet|user/ }
end
# Redirect old note attachments path to new uploads path.
get "files/note/:id/:filename",
to: redirect("uploads/note/attachment/%{id}/%{filename}"),
2018-01-27 00:35:53 -05:00
constraints: { filename: %r{[^/]+} }