2016-11-03 12:29:30 +05:30
|
|
|
scope path: :uploads do
|
|
|
|
# Note attachments and User/Group/Project 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",
|
2018-03-17 18:26:18 +05:30
|
|
|
constraints: { model: /note|user|group|project/, 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',
|
2018-03-17 18:26:18 +05:30
|
|
|
constraints: { model: /personal_snippet/, 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",
|
2018-11-08 19:23:39 +05:30
|
|
|
constraints: { model: /appearance/, mounted_as: /logo|header_logo|favicon/, filename: /.+/ }
|
2016-11-03 12:29:30 +05:30
|
|
|
|
|
|
|
# Project markdown uploads
|
|
|
|
get ":namespace_id/:project_id/:secret/:filename",
|
|
|
|
to: "projects/uploads#show",
|
2018-03-17 18:26:18 +05:30
|
|
|
constraints: { namespace_id: /[a-zA-Z.0-9_\-]+/, project_id: /[a-zA-Z.0-9_\-]+/, filename: %r{[^/]+} }
|
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',
|
|
|
|
constraints: { model: /personal_snippet/, id: /\d+/ },
|
|
|
|
as: 'upload'
|
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{[^/]+} }
|