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:
Diffstat (limited to 'app/controllers/snippets_controller.rb')
-rw-r--r--app/controllers/snippets_controller.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index bfcfda0fc71..3d56bebe2fe 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -1,7 +1,7 @@
class SnippetsController < ApplicationController
before_filter :authenticate_user!
before_filter :project
- before_filter :snippet, :only => [:show, :edit, :destroy, :update]
+ before_filter :snippet, :only => [:show, :edit, :destroy, :update, :raw]
layout "project"
# Authorize
@@ -67,7 +67,17 @@ class SnippetsController < ApplicationController
redirect_to project_snippets_path(@project)
end
+ def raw
+ send_data(
+ @snippet.content,
+ :type => "text/plain",
+ :disposition => 'inline',
+ :filename => @snippet.file_name
+ )
+ end
+
protected
+
def snippet
@snippet ||= @project.snippets.find(params[:id])
end