Commit 5484acd9 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'empty-project-redirect-vs-404' into 'master'

Redirect from /tree/master on empty repo instead of showing 404.

See https://gitlab.com/gitlab-org/gitlab-ce/issues/1114

See merge request !1559
parents 626f5bab 00408f37
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
class Projects::BlameController < Projects::ApplicationController class Projects::BlameController < Projects::ApplicationController
include ExtractsPath include ExtractsPath
before_filter :require_non_empty_project
before_filter :assign_ref_vars before_filter :assign_ref_vars
before_filter :authorize_download_code! before_filter :authorize_download_code!
before_filter :require_non_empty_project
def show def show
@blob = @repository.blob_at(@commit.id, @path) @blob = @repository.blob_at(@commit.id, @path)
......
...@@ -5,8 +5,8 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -5,8 +5,8 @@ class Projects::BlobController < Projects::ApplicationController
# Raised when given an invalid file path # Raised when given an invalid file path
class InvalidPathError < StandardError; end class InvalidPathError < StandardError; end
before_filter :authorize_download_code!
before_filter :require_non_empty_project, except: [:new, :create] before_filter :require_non_empty_project, except: [:new, :create]
before_filter :authorize_download_code!
before_filter :authorize_push_code!, only: [:destroy] before_filter :authorize_push_code!, only: [:destroy]
before_filter :assign_blob_vars before_filter :assign_blob_vars
before_filter :commit, except: [:new, :create] before_filter :commit, except: [:new, :create]
......
...@@ -2,7 +2,6 @@ class Projects::BranchesController < Projects::ApplicationController ...@@ -2,7 +2,6 @@ class Projects::BranchesController < Projects::ApplicationController
include ActionView::Helpers::SanitizeHelper include ActionView::Helpers::SanitizeHelper
# Authorize # Authorize
before_filter :require_non_empty_project before_filter :require_non_empty_project
before_filter :authorize_download_code! before_filter :authorize_download_code!
before_filter :authorize_push_code!, only: [:create, :destroy] before_filter :authorize_push_code!, only: [:create, :destroy]
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
# Not to be confused with CommitsController, plural. # Not to be confused with CommitsController, plural.
class Projects::CommitController < Projects::ApplicationController class Projects::CommitController < Projects::ApplicationController
# Authorize # Authorize
before_filter :authorize_download_code!
before_filter :require_non_empty_project before_filter :require_non_empty_project
before_filter :authorize_download_code!
before_filter :commit before_filter :commit
def show def show
......
...@@ -3,9 +3,9 @@ require "base64" ...@@ -3,9 +3,9 @@ require "base64"
class Projects::CommitsController < Projects::ApplicationController class Projects::CommitsController < Projects::ApplicationController
include ExtractsPath include ExtractsPath
before_filter :require_non_empty_project
before_filter :assign_ref_vars before_filter :assign_ref_vars
before_filter :authorize_download_code! before_filter :authorize_download_code!
before_filter :require_non_empty_project
def show def show
@repo = @project.repository @repo = @project.repository
......
class Projects::CompareController < Projects::ApplicationController class Projects::CompareController < Projects::ApplicationController
# Authorize # Authorize
before_filter :authorize_download_code!
before_filter :require_non_empty_project before_filter :require_non_empty_project
before_filter :authorize_download_code!
def index def index
end end
......
class Projects::ForksController < Projects::ApplicationController class Projects::ForksController < Projects::ApplicationController
# Authorize # Authorize
before_filter :authorize_download_code!
before_filter :require_non_empty_project before_filter :require_non_empty_project
before_filter :authorize_download_code!
def new def new
@namespaces = current_user.manageable_namespaces @namespaces = current_user.manageable_namespaces
......
class Projects::GraphsController < Projects::ApplicationController class Projects::GraphsController < Projects::ApplicationController
# Authorize # Authorize
before_filter :authorize_download_code!
before_filter :require_non_empty_project before_filter :require_non_empty_project
before_filter :authorize_download_code!
def show def show
respond_to do |format| respond_to do |format|
......
...@@ -2,9 +2,9 @@ class Projects::NetworkController < Projects::ApplicationController ...@@ -2,9 +2,9 @@ class Projects::NetworkController < Projects::ApplicationController
include ExtractsPath include ExtractsPath
include ApplicationHelper include ApplicationHelper
before_filter :require_non_empty_project
before_filter :assign_ref_vars before_filter :assign_ref_vars
before_filter :authorize_download_code! before_filter :authorize_download_code!
before_filter :require_non_empty_project
def show def show
respond_to do |format| respond_to do |format|
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
class Projects::RawController < Projects::ApplicationController class Projects::RawController < Projects::ApplicationController
include ExtractsPath include ExtractsPath
before_filter :require_non_empty_project
before_filter :assign_ref_vars before_filter :assign_ref_vars
before_filter :authorize_download_code! before_filter :authorize_download_code!
before_filter :require_non_empty_project
def show def show
@blob = @repository.blob_at(@commit.id, @path) @blob = @repository.blob_at(@commit.id, @path)
......
class Projects::RefsController < Projects::ApplicationController class Projects::RefsController < Projects::ApplicationController
include ExtractsPath include ExtractsPath
before_filter :require_non_empty_project
before_filter :assign_ref_vars before_filter :assign_ref_vars
before_filter :authorize_download_code! before_filter :authorize_download_code!
before_filter :require_non_empty_project
def switch def switch
respond_to do |format| respond_to do |format|
......
class Projects::RepositoriesController < Projects::ApplicationController class Projects::RepositoriesController < Projects::ApplicationController
# Authorize # Authorize
before_filter :authorize_download_code!
before_filter :require_non_empty_project, except: :create before_filter :require_non_empty_project, except: :create
before_filter :authorize_download_code!
before_filter :authorize_admin_project!, only: :create before_filter :authorize_admin_project!, only: :create
def create def create
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
class Projects::TreeController < Projects::ApplicationController class Projects::TreeController < Projects::ApplicationController
include ExtractsPath include ExtractsPath
before_filter :require_non_empty_project, except: [:new, :create]
before_filter :assign_ref_vars before_filter :assign_ref_vars
before_filter :authorize_download_code! before_filter :authorize_download_code!
before_filter :require_non_empty_project, except: [:new, :create]
def show def show
if tree.entries.empty? if tree.entries.empty?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment