Empty Public Project returns 500 error
Created by: karlhungus
https://github.com/gitlabhq/gitlabhq/blob/master/app/controllers/public/projects_controller.rb
Seems that on line 22 @tree = Tree.new(@repository, @commit.id)
of show
:
def show
@project = Project.public_only.find_with_namespace(params[:id])
render_404 and return unless @project
@repository = @project.repository
@recent_tags = @repository.tags.first(10)
@commit = @repository.commit(params[:ref])
@tree = Tree.new(@repository, @commit.id)
end
There is no @commit
(because project is empty).
Error logs:
production.log
Started GET "/public/projects/ialpert/izaak-test" for 127.0.0.1 at 2013-09-16 16:03:25 -0400
Processing by Public::ProjectsController#show as HTML
Parameters: {"id"=>"ialpert/izaak-test"}
Completed 500 Internal Server Error in 15ms
NoMethodError (undefined method `id' for nil:NilClass):
app/controllers/public/projects_controller.rb:22:in `show'
To reproduce
- Create a new empty project
- Set project to public
- go to public projects page
- click on project -> 500 error