diff options
author | Marin Jankovski <marin@gitlab.com> | 2014-04-24 17:00:18 +0400 |
---|---|---|
committer | Marin Jankovski <marin@gitlab.com> | 2014-04-24 17:00:18 +0400 |
commit | 0050c07fdda59f36ca2959e08d422ff5d6479e10 (patch) | |
tree | 16dcb2756451c8afc85813f3b95ba59677eeea06 /app/controllers/projects/wikis_controller.rb | |
parent | 1feaa336edf7a16ca39b036345890f05d35a1463 (diff) |
Serve a file if in wiki.
Diffstat (limited to 'app/controllers/projects/wikis_controller.rb')
-rw-r--r-- | app/controllers/projects/wikis_controller.rb | 11 |
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) |