Commit a9d224d36db59446f944c29a10725a85ebda3c5d
1 parent
4e063dea
Exists in
master
and in
4 other branches
issue #124
Showing
3 changed files
with
8 additions
and
1 deletions
Show diff stats
app/controllers/application_controller.rb
| ... | ... | @@ -61,4 +61,8 @@ class ApplicationController < ActionController::Base |
| 61 | 61 | def render_404 |
| 62 | 62 | render :file => File.join(Rails.root, "public", "404"), :layout => false, :status => "404" |
| 63 | 63 | end |
| 64 | + | |
| 65 | + def require_non_empty_project | |
| 66 | + redirect_to @project unless @project.repo_exists? | |
| 67 | + end | |
| 64 | 68 | end | ... | ... |
app/controllers/commits_controller.rb
app/controllers/projects_controller.rb
| ... | ... | @@ -6,6 +6,8 @@ class ProjectsController < ApplicationController |
| 6 | 6 | before_filter :authorize_read_project!, :except => [:index, :new, :create] |
| 7 | 7 | before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy] |
| 8 | 8 | |
| 9 | + before_filter :require_non_empty_project, :only => [:blob, :tree] | |
| 10 | + | |
| 9 | 11 | def index |
| 10 | 12 | @projects = current_user.projects.all |
| 11 | 13 | end |
| ... | ... | @@ -48,7 +50,7 @@ class ProjectsController < ApplicationController |
| 48 | 50 | def update |
| 49 | 51 | respond_to do |format| |
| 50 | 52 | if project.update_attributes(params[:project]) |
| 51 | - format.html { redirect_to project, notice: 'Project was successfully updated.' } | |
| 53 | + format.html { redirect_to project, :notice => 'Project was successfully updated.' } | |
| 52 | 54 | format.js |
| 53 | 55 | else |
| 54 | 56 | format.html { render action: "edit" } | ... | ... |