Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
c9161241
Commit
c9161241
authored
Jan 26, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explicitly set before_filter for ref-related controllers
parent
6a2384e0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
15 deletions
+12
-15
app/controllers/projects/blame_controller.rb
app/controllers/projects/blame_controller.rb
+1
-1
app/controllers/projects/commits_controller.rb
app/controllers/projects/commits_controller.rb
+1
-1
app/controllers/projects/network_controller.rb
app/controllers/projects/network_controller.rb
+1
-1
app/controllers/projects/raw_controller.rb
app/controllers/projects/raw_controller.rb
+1
-1
app/controllers/projects/refs_controller.rb
app/controllers/projects/refs_controller.rb
+1
-1
app/controllers/projects/tree_controller.rb
app/controllers/projects/tree_controller.rb
+7
-2
lib/extracts_path.rb
lib/extracts_path.rb
+0
-8
No files found.
app/controllers/projects/blame_controller.rb
View file @
c9161241
...
@@ -2,7 +2,7 @@
...
@@ -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
...
...
app/controllers/projects/commits_controller.rb
View file @
c9161241
...
@@ -3,7 +3,7 @@ require "base64"
...
@@ -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
...
...
app/controllers/projects/network_controller.rb
View file @
c9161241
...
@@ -2,7 +2,7 @@ class Projects::NetworkController < Projects::ApplicationController
...
@@ -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
...
...
app/controllers/projects/raw_controller.rb
View file @
c9161241
...
@@ -2,7 +2,7 @@
...
@@ -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
...
...
app/controllers/projects/refs_controller.rb
View file @
c9161241
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
...
...
app/controllers/projects/tree_controller.rb
View file @
c9161241
# 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
...
...
lib/extracts_path.rb
View file @
c9161241
# 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.
#
#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment