2016-10-05 08:21:27 -04:00
|
|
|
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",
|
2016-10-05 08:21:27 -04:00
|
|
|
to: "uploads#show",
|
|
|
|
constraints: { model: /note|user|group|project/, mounted_as: /avatar|attachment/, filename: /[^\/]+/ }
|
|
|
|
|
2017-05-01 09:14:35 -04:00
|
|
|
# show uploads for models, snippets (notes) available for now
|
2017-06-27 06:53:06 -04:00
|
|
|
get 'system/:model/:id/:secret/:filename',
|
2017-05-01 09:14:35 -04:00
|
|
|
to: 'uploads#show',
|
|
|
|
constraints: { model: /personal_snippet/, id: /\d+/, filename: /[^\/]+/ }
|
|
|
|
|
2017-05-29 03:54:35 -04:00
|
|
|
# show temporary uploads
|
2017-06-27 06:53:06 -04:00
|
|
|
get 'system/temp/:secret/:filename',
|
2017-05-29 03:54:35 -04:00
|
|
|
to: 'uploads#show',
|
|
|
|
constraints: { filename: /[^\/]+/ }
|
|
|
|
|
2016-10-05 08:21:27 -04:00
|
|
|
# Appearance
|
2017-07-17 03:16:33 -04:00
|
|
|
get "-/system/:model/:mounted_as/:id/:filename",
|
2016-10-05 08:21:27 -04:00
|
|
|
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: /[^\/]+/ }
|
2017-05-01 09:14:35 -04:00
|
|
|
|
|
|
|
# create uploads for models, snippets (notes) available for now
|
2017-05-03 11:26:49 -04:00
|
|
|
post ':model',
|
2017-05-01 09:14:35 -04:00
|
|
|
to: 'uploads#create',
|
|
|
|
constraints: { model: /personal_snippet/, id: /\d+/ },
|
|
|
|
as: 'upload'
|
2016-10-05 08:21:27 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
# Redirect old note attachments path to new uploads path.
|
|
|
|
get "files/note/:id/:filename",
|
|
|
|
to: redirect("uploads/note/attachment/%{id}/%{filename}"),
|
|
|
|
constraints: { filename: /[^\/]+/ }
|