2021-02-03 21:09:17 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-10-05 12:21:27 +00:00
|
|
|
scope path: :uploads do
|
|
|
|
# Note attachments and User/Group/Project avatars
|
2017-07-17 07:16:33 +00:00
|
|
|
get "-/system/:model/:mounted_as/:id/:filename",
|
2016-10-05 12:21:27 +00:00
|
|
|
to: "uploads#show",
|
2018-01-27 05:35:53 +00:00
|
|
|
constraints: { model: /note|user|group|project/, mounted_as: /avatar|attachment/, filename: %r{[^/]+} }
|
2016-10-05 12:21:27 +00:00
|
|
|
|
2017-05-01 13:14:35 +00:00
|
|
|
# show uploads for models, snippets (notes) available for now
|
2017-08-07 17:43:11 +00:00
|
|
|
get '-/system/:model/:id/:secret/:filename',
|
2017-05-01 13:14:35 +00:00
|
|
|
to: 'uploads#show',
|
2019-06-04 23:50:57 +00:00
|
|
|
constraints: { model: /personal_snippet|user/, id: /\d+/, filename: %r{[^/]+} }
|
2017-05-01 13:14:35 +00:00
|
|
|
|
2017-05-29 07:54:35 +00:00
|
|
|
# show temporary uploads
|
2017-08-07 17:43:11 +00:00
|
|
|
get '-/system/temp/:secret/:filename',
|
2017-05-29 07:54:35 +00:00
|
|
|
to: 'uploads#show',
|
2018-01-27 05:35:53 +00:00
|
|
|
constraints: { filename: %r{[^/]+} }
|
2017-05-29 07:54:35 +00:00
|
|
|
|
2016-10-05 12:21:27 +00:00
|
|
|
# Appearance
|
2017-07-17 07:16:33 +00:00
|
|
|
get "-/system/:model/:mounted_as/:id/:filename",
|
2016-10-05 12:21:27 +00:00
|
|
|
to: "uploads#show",
|
2018-12-25 08:24:00 +00:00
|
|
|
constraints: { model: /appearance/, mounted_as: /logo|header_logo|favicon/, filename: /.+/ },
|
|
|
|
as: 'appearance_upload'
|
2016-10-05 12:21:27 +00:00
|
|
|
|
|
|
|
# Project markdown uploads
|
2020-01-13 09:08:03 +00:00
|
|
|
# DEPRECATED: Remove this in GitLab 13.0 because this is redundant to show_namespace_project_uploads
|
|
|
|
# https://gitlab.com/gitlab-org/gitlab/issues/196396
|
2016-10-05 12:21:27 +00:00
|
|
|
get ":namespace_id/:project_id/:secret/:filename",
|
2020-01-13 09:08:03 +00:00
|
|
|
to: redirect("%{namespace_id}/%{project_id}/uploads/%{secret}/%{filename}"),
|
|
|
|
constraints: { namespace_id: /[a-zA-Z.0-9_\-]+/, project_id: /[a-zA-Z.0-9_\-]+/, filename: %r{[^/]+} }, format: false, defaults: { format: nil }
|
2017-05-01 13:14:35 +00:00
|
|
|
|
|
|
|
# create uploads for models, snippets (notes) available for now
|
2017-05-03 15:26:49 +00:00
|
|
|
post ':model',
|
2017-05-01 13:14:35 +00:00
|
|
|
to: 'uploads#create',
|
2019-06-04 23:50:57 +00:00
|
|
|
constraints: { model: /personal_snippet|user/, id: /\d+/ },
|
2017-05-01 13:14:35 +00:00
|
|
|
as: 'upload'
|
2019-07-09 18:51:42 +00:00
|
|
|
|
|
|
|
post ':model/authorize',
|
|
|
|
to: 'uploads#authorize',
|
|
|
|
constraints: { model: /personal_snippet|user/ }
|
2016-10-05 12:21:27 +00:00
|
|
|
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 05:35:53 +00:00
|
|
|
constraints: { filename: %r{[^/]+} }
|