Commit 0050c07f authored by Marin Jankovski's avatar Marin Jankovski

Serve a file if in wiki.

parent 1feaa336
...@@ -15,6 +15,17 @@ class Projects::WikisController < Projects::ApplicationController ...@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment