diff options
Diffstat (limited to 'app/controllers/concerns/snippets_actions.rb')
-rw-r--r-- | app/controllers/concerns/snippets_actions.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/controllers/concerns/snippets_actions.rb b/app/controllers/concerns/snippets_actions.rb index b12aee346ed..096c6efc0fc 100644 --- a/app/controllers/concerns/snippets_actions.rb +++ b/app/controllers/concerns/snippets_actions.rb @@ -4,6 +4,10 @@ module SnippetsActions extend ActiveSupport::Concern include SendsBlob + included do + before_action :redirect_if_binary, only: [:edit, :update] + end + def edit # We need to load some info from the existing blob snippet.content = blob.data @@ -67,4 +71,8 @@ module SnippetsActions flash.now[:alert] = repository_errors.first if repository_errors.present? recaptcha_check_with_fallback(repository_errors.empty?) { render :edit } end + + def redirect_if_binary + redirect_to gitlab_snippet_path(snippet) if blob&.binary? + end end |