Commit a699ebdbcc11051b9473a88788cf8efdde659975
1 parent
ab0cfc00
Exists in
master
and in
4 other branches
handle attahcment with send_file
Showing
5 changed files
with
19 additions
and
2 deletions
Show diff stats
app/uploaders/attachment_uploader.rb
app/views/events/event/_note.html.haml
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | = markdown truncate(event.target.note, length: 70) |
| 27 | 27 | - note = event.target |
| 28 | 28 | - if note.attachment.url |
| 29 | - = link_to note.attachment.url, target: "_blank", class: 'note-file-attach' do | |
| 29 | + = link_to note.attachment.secure_url, target: "_blank", class: 'note-file-attach' do | |
| 30 | 30 | - if note.attachment.image? |
| 31 | 31 | = image_tag note.attachment.url, class: 'note-image-attach' |
| 32 | 32 | - else | ... | ... |
app/views/notes/_note.html.haml
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | - if note.attachment.image? |
| 32 | 32 | = image_tag note.attachment.url, class: 'note-image-attach' |
| 33 | 33 | .attachment.pull-right |
| 34 | - = link_to note.attachment.url, target: "_blank" do | |
| 34 | + = link_to note.attachment.secure_url, target: "_blank" do | |
| 35 | 35 | %i.icon-paper-clip |
| 36 | 36 | = note.attachment_identifier |
| 37 | 37 | .clear | ... | ... |
config/routes.rb
| ... | ... | @@ -46,6 +46,11 @@ Gitlab::Application.routes.draw do |
| 46 | 46 | end |
| 47 | 47 | |
| 48 | 48 | # |
| 49 | + # Attachments serving | |
| 50 | + # | |
| 51 | + get 'files/:type/:id/:filename' => 'files#download', constraints: { id: /\d+/, type: /[a-z]+/, filename: /[a-zA-Z.0-9_\-\+]+/ } | |
| 52 | + | |
| 53 | + # | |
| 49 | 54 | # Admin Area |
| 50 | 55 | # |
| 51 | 56 | namespace :admin do | ... | ... |