Serve a file if in wiki.
This commit is contained in:
parent
1feaa336ed
commit
0050c07fdd
|
@ -15,6 +15,17 @@ class Projects::WikisController < Projects::ApplicationController
|
||||||
|
|
||||||
if @page
|
if @page
|
||||||
render 'show'
|
render 'show'
|
||||||
|
elsif file = @project_wiki.wiki.file(params[:id], @project_wiki.wiki.ref, true)
|
||||||
|
if file.on_disk?
|
||||||
|
send_file file.on_disk_path, :disposition => 'inline'
|
||||||
|
else
|
||||||
|
send_data(
|
||||||
|
file.raw_data,
|
||||||
|
type: file.mime_type,
|
||||||
|
disposition: 'inline',
|
||||||
|
filename: file.name
|
||||||
|
)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
return render('empty') unless can?(current_user, :write_wiki, @project)
|
return render('empty') unless can?(current_user, :write_wiki, @project)
|
||||||
@page = WikiPage.new(@project_wiki)
|
@page = WikiPage.new(@project_wiki)
|
||||||
|
|
Loading…
Reference in New Issue