Explicitly set before_filter for ref-related controllers
This commit is contained in:
parent
6a2384e0bc
commit
c916124178
7 changed files with 12 additions and 15 deletions
|
@ -2,7 +2,7 @@
|
|||
class Projects::BlameController < Projects::ApplicationController
|
||||
include ExtractsPath
|
||||
|
||||
# Authorize
|
||||
before_filter :assign_ref_vars
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require "base64"
|
|||
class Projects::CommitsController < Projects::ApplicationController
|
||||
include ExtractsPath
|
||||
|
||||
# Authorize
|
||||
before_filter :assign_ref_vars
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ class Projects::NetworkController < Projects::ApplicationController
|
|||
include ExtractsPath
|
||||
include ApplicationHelper
|
||||
|
||||
# Authorize
|
||||
before_filter :assign_ref_vars
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
class Projects::RawController < Projects::ApplicationController
|
||||
include ExtractsPath
|
||||
|
||||
# Authorize
|
||||
before_filter :assign_ref_vars
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class Projects::RefsController < Projects::ApplicationController
|
||||
include ExtractsPath
|
||||
|
||||
# Authorize
|
||||
before_filter :assign_ref_vars
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
# Controller for viewing a repository's file structure
|
||||
class Projects::TreeController < Projects::BaseTreeController
|
||||
def show
|
||||
class Projects::TreeController < Projects::ApplicationController
|
||||
include ExtractsPath
|
||||
|
||||
before_filter :assign_ref_vars
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :require_non_empty_project, except: [:new, :create]
|
||||
|
||||
def show
|
||||
if tree.entries.empty?
|
||||
if @repository.blob_at(@commit.id, @path)
|
||||
redirect_to project_blob_path(@project, File.join(@ref, @path)) and return
|
||||
|
|
|
@ -1,17 +1,9 @@
|
|||
# Module providing methods for dealing with separating a tree-ish string and a
|
||||
# file path string when combined in a request parameter
|
||||
module ExtractsPath
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
# Raised when given an invalid file path
|
||||
class InvalidPathError < StandardError; end
|
||||
|
||||
included do
|
||||
if respond_to?(:before_filter)
|
||||
before_filter :assign_ref_vars
|
||||
end
|
||||
end
|
||||
|
||||
# Given a string containing both a Git tree-ish, such as a branch or tag, and
|
||||
# a filesystem path joined by forward slashes, attempts to separate the two.
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue