Skip to content
Snippets Groups Projects
Commit 0050c07f authored by Marin Jankovski's avatar Marin Jankovski
Browse files

Serve a file if in wiki.

parent 1feaa336
Branches
Tags
Loading
Loading
Loading
@@ -15,6 +15,17 @@ class Projects::WikisController < Projects::ApplicationController
 
if @page
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
return render('empty') unless can?(current_user, :write_wiki, @project)
@page = WikiPage.new(@project_wiki)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment