Commit 0050c07fdda59f36ca2959e08d422ff5d6479e10
1 parent
1feaa336
Exists in
spb-stable
and in
2 other branches
Serve a file if in wiki.
Showing
1 changed file
with
11 additions
and
0 deletions
Show diff stats
app/controllers/projects/wikis_controller.rb
@@ -15,6 +15,17 @@ class Projects::WikisController < Projects::ApplicationController | @@ -15,6 +15,17 @@ class Projects::WikisController < Projects::ApplicationController | ||
15 | 15 | ||
16 | if @page | 16 | if @page |
17 | render 'show' | 17 | render 'show' |
18 | + elsif file = @project_wiki.wiki.file(params[:id], @project_wiki.wiki.ref, true) | ||
19 | + if file.on_disk? | ||
20 | + send_file file.on_disk_path, :disposition => 'inline' | ||
21 | + else | ||
22 | + send_data( | ||
23 | + file.raw_data, | ||
24 | + type: file.mime_type, | ||
25 | + disposition: 'inline', | ||
26 | + filename: file.name | ||
27 | + ) | ||
28 | + end | ||
18 | else | 29 | else |
19 | return render('empty') unless can?(current_user, :write_wiki, @project) | 30 | return render('empty') unless can?(current_user, :write_wiki, @project) |
20 | @page = WikiPage.new(@project_wiki) | 31 | @page = WikiPage.new(@project_wiki) |