Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Jankovski <marin@gitlab.com>2014-04-24 17:00:18 +0400
committerMarin Jankovski <marin@gitlab.com>2014-04-24 17:00:18 +0400
commit0050c07fdda59f36ca2959e08d422ff5d6479e10 (patch)
tree16dcb2756451c8afc85813f3b95ba59677eeea06 /app/controllers/projects/wikis_controller.rb
parent1feaa336edf7a16ca39b036345890f05d35a1463 (diff)
Serve a file if in wiki.
Diffstat (limited to 'app/controllers/projects/wikis_controller.rb')
-rw-r--r--app/controllers/projects/wikis_controller.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb
index bcd9e0d5219..0eb9364eaa4 100644
--- a/app/controllers/projects/wikis_controller.rb
+++ b/app/controllers/projects/wikis_controller.rb
@@ -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)