2021-03-11 19:13:27 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-11-03 12:29:30 +05:30
|
|
|
scope path: :uploads do
|
2021-11-18 22:05:49 +05:30
|
|
|
# Note attachments and User/Group/Project/Topic avatars
|
2017-09-10 17:25:29 +05:30
|
|
|
get "-/system/:model/:mounted_as/:id/:filename",
|
2016-11-03 12:29:30 +05:30
|
|
|
to: "uploads#show",
|
2021-11-18 22:05:49 +05:30
|
|
|
constraints: { model: %r{note|user|group|project|projects\/topic}, mounted_as: /avatar|attachment/, filename: %r{[^/]+} }
|
2016-11-03 12:29:30 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
# show uploads for models, snippets (notes) available for now
|
2017-09-10 17:25:29 +05:30
|
|
|
get '-/system/:model/:id/:secret/:filename',
|
2017-08-17 22:00:37 +05:30
|
|
|
to: 'uploads#show',
|
2019-07-07 11:18:12 +05:30
|
|
|
constraints: { model: /personal_snippet|user/, id: /\d+/, filename: %r{[^/]+} }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
# show temporary uploads
|
|
|
|
get '-/system/temp/:secret/:filename',
|
|
|
|
to: 'uploads#show',
|
2018-03-17 18:26:18 +05:30
|
|
|
constraints: { filename: %r{[^/]+} }
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2016-11-03 12:29:30 +05:30
|
|
|
# Appearance
|
2017-09-10 17:25:29 +05:30
|
|
|
get "-/system/:model/:mounted_as/:id/:filename",
|
2016-11-03 12:29:30 +05:30
|
|
|
to: "uploads#show",
|
2019-02-15 15:39:39 +05:30
|
|
|
constraints: { model: /appearance/, mounted_as: /logo|header_logo|favicon/, filename: /.+/ },
|
|
|
|
as: 'appearance_upload'
|
2016-11-03 12:29:30 +05:30
|
|
|
|
|
|
|
# Project markdown uploads
|
2020-03-13 15:44:24 +05:30
|
|
|
# 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-11-03 12:29:30 +05:30
|
|
|
get ":namespace_id/:project_id/:secret/:filename",
|
2020-03-13 15:44:24 +05:30
|
|
|
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-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
# create uploads for models, snippets (notes) available for now
|
2017-09-10 17:25:29 +05:30
|
|
|
post ':model',
|
2017-08-17 22:00:37 +05:30
|
|
|
to: 'uploads#create',
|
2019-07-07 11:18:12 +05:30
|
|
|
constraints: { model: /personal_snippet|user/, id: /\d+/ },
|
2017-08-17 22:00:37 +05:30
|
|
|
as: 'upload'
|
2019-09-04 21:01:54 +05:30
|
|
|
|
|
|
|
post ':model/authorize',
|
|
|
|
to: 'uploads#authorize',
|
|
|
|
constraints: { model: /personal_snippet|user/ }
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
# Redirect old note attachments path to new uploads path.
|
|
|
|
get "files/note/:id/:filename",
|
|
|
|
to: redirect("uploads/note/attachment/%{id}/%{filename}"),
|
2018-03-17 18:26:18 +05:30
|
|
|
constraints: { filename: %r{[^/]+} }
|