BigW Consortium Gitlab

uploads.rb 1.4 KB
Newer Older
1 2
scope path: :uploads do
  # Note attachments and User/Group/Project avatars
3
  get "-/system/:model/:mounted_as/:id/:filename",
4 5 6
      to:           "uploads#show",
      constraints:  { model: /note|user|group|project/, mounted_as: /avatar|attachment/, filename: /[^\/]+/ }

7
  # show uploads for models, snippets (notes) available for now
8
  get 'system/:model/:id/:secret/:filename',
9 10 11
    to: 'uploads#show',
    constraints: { model: /personal_snippet/, id: /\d+/, filename: /[^\/]+/ }

12
  # show temporary uploads
13
  get 'system/temp/:secret/:filename',
14 15 16
    to: 'uploads#show',
    constraints: { filename: /[^\/]+/ }

17
  # Appearance
18
  get "-/system/:model/:mounted_as/:id/:filename",
19 20 21 22 23 24 25
      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: /[^\/]+/ }
26 27

  # create uploads for models, snippets (notes) available for now
28
  post ':model',
29 30 31
    to: 'uploads#create',
    constraints: { model: /personal_snippet/, id: /\d+/ },
    as: 'upload'
32 33 34 35 36 37
end

# Redirect old note attachments path to new uploads path.
get "files/note/:id/:filename",
  to:           redirect("uploads/note/attachment/%{id}/%{filename}"),
  constraints:  { filename: /[^\/]+/ }