diff options
| author | gitlabhq <m@gitlabhq.com> | 2011-10-15 18:51:58 +0300 |
|---|---|---|
| committer | gitlabhq <m@gitlabhq.com> | 2011-10-15 18:51:58 +0300 |
| commit | a9d224d36db59446f944c29a10725a85ebda3c5d (patch) | |
| tree | af254c3b90a9dfbffed7f94cc6c8217e466e42cc | |
| parent | 4e063deaa95f6d923420c1548bfb73f9be4131c8 (diff) | |
| download | gitlab-ce-a9d224d36db59446f944c29a10725a85ebda3c5d.tar.gz | |
issue #124
| -rw-r--r-- | app/controllers/application_controller.rb | 4 | ||||
| -rw-r--r-- | app/controllers/commits_controller.rb | 1 | ||||
| -rw-r--r-- | app/controllers/projects_controller.rb | 4 |
3 files changed, 8 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f8eb238b1d2..2866d1a7358 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -61,4 +61,8 @@ class ApplicationController < ActionController::Base def render_404 render :file => File.join(Rails.root, "public", "404"), :layout => false, :status => "404" end + + def require_non_empty_project + redirect_to @project unless @project.repo_exists? + end end diff --git a/app/controllers/commits_controller.rb b/app/controllers/commits_controller.rb index af82b1cd901..83071891be4 100644 --- a/app/controllers/commits_controller.rb +++ b/app/controllers/commits_controller.rb @@ -6,6 +6,7 @@ class CommitsController < ApplicationController # Authorize before_filter :add_project_abilities before_filter :authorize_read_project! + before_filter :require_non_empty_project def index load_refs # load @branch, @tag & @ref diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 1cc2fd63faa..e8f1c3925c9 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -6,6 +6,8 @@ class ProjectsController < ApplicationController before_filter :authorize_read_project!, :except => [:index, :new, :create] before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy] + before_filter :require_non_empty_project, :only => [:blob, :tree] + def index @projects = current_user.projects.all end @@ -48,7 +50,7 @@ class ProjectsController < ApplicationController def update respond_to do |format| if project.update_attributes(params[:project]) - format.html { redirect_to project, notice: 'Project was successfully updated.' } + format.html { redirect_to project, :notice => 'Project was successfully updated.' } format.js else format.html { render action: "edit" } |
