Explicitly set before_filter for ref-related controllers
This commit is contained in:
parent
6a2384e0bc
commit
c916124178
|
@ -2,7 +2,7 @@
|
||||||
class Projects::BlameController < Projects::ApplicationController
|
class Projects::BlameController < Projects::ApplicationController
|
||||||
include ExtractsPath
|
include ExtractsPath
|
||||||
|
|
||||||
# Authorize
|
before_filter :assign_ref_vars
|
||||||
before_filter :authorize_download_code!
|
before_filter :authorize_download_code!
|
||||||
before_filter :require_non_empty_project
|
before_filter :require_non_empty_project
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ require "base64"
|
||||||
class Projects::CommitsController < Projects::ApplicationController
|
class Projects::CommitsController < Projects::ApplicationController
|
||||||
include ExtractsPath
|
include ExtractsPath
|
||||||
|
|
||||||
# Authorize
|
before_filter :assign_ref_vars
|
||||||
before_filter :authorize_download_code!
|
before_filter :authorize_download_code!
|
||||||
before_filter :require_non_empty_project
|
before_filter :require_non_empty_project
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ class Projects::NetworkController < Projects::ApplicationController
|
||||||
include ExtractsPath
|
include ExtractsPath
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
|
||||||
# Authorize
|
before_filter :assign_ref_vars
|
||||||
before_filter :authorize_download_code!
|
before_filter :authorize_download_code!
|
||||||
before_filter :require_non_empty_project
|
before_filter :require_non_empty_project
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
class Projects::RawController < Projects::ApplicationController
|
class Projects::RawController < Projects::ApplicationController
|
||||||
include ExtractsPath
|
include ExtractsPath
|
||||||
|
|
||||||
# Authorize
|
before_filter :assign_ref_vars
|
||||||
before_filter :authorize_download_code!
|
before_filter :authorize_download_code!
|
||||||
before_filter :require_non_empty_project
|
before_filter :require_non_empty_project
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class Projects::RefsController < Projects::ApplicationController
|
class Projects::RefsController < Projects::ApplicationController
|
||||||
include ExtractsPath
|
include ExtractsPath
|
||||||
|
|
||||||
# Authorize
|
before_filter :assign_ref_vars
|
||||||
before_filter :authorize_download_code!
|
before_filter :authorize_download_code!
|
||||||
before_filter :require_non_empty_project
|
before_filter :require_non_empty_project
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
# Controller for viewing a repository's file structure
|
# Controller for viewing a repository's file structure
|
||||||
class Projects::TreeController < Projects::BaseTreeController
|
class Projects::TreeController < Projects::ApplicationController
|
||||||
def show
|
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 tree.entries.empty?
|
||||||
if @repository.blob_at(@commit.id, @path)
|
if @repository.blob_at(@commit.id, @path)
|
||||||
redirect_to project_blob_path(@project, File.join(@ref, @path)) and return
|
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
|
# Module providing methods for dealing with separating a tree-ish string and a
|
||||||
# file path string when combined in a request parameter
|
# file path string when combined in a request parameter
|
||||||
module ExtractsPath
|
module ExtractsPath
|
||||||
extend ActiveSupport::Concern
|
|
||||||
|
|
||||||
# Raised when given an invalid file path
|
# Raised when given an invalid file path
|
||||||
class InvalidPathError < StandardError; end
|
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
|
# 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.
|
# a filesystem path joined by forward slashes, attempts to separate the two.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue