Only load tree when project has repository to prevent 404

This commit is contained in:
Douwe Maan 2015-10-18 11:22:33 +02:00
parent aebe0ddc33
commit ff866faf2f
1 changed files with 5 additions and 1 deletions

View File

@ -5,7 +5,7 @@ class ProjectsController < ApplicationController
skip_before_action :authenticate_user!, only: [:show, :activity]
before_action :project, except: [:new, :create]
before_action :repository, except: [:new, :create]
before_action :assign_ref_vars, :tree, only: [:show]
before_action :assign_ref_vars, :tree, only: [:show], if: :repo_exists?
# Authorize
before_action :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer, :archive, :unarchive]
@ -229,6 +229,10 @@ class ProjectsController < ApplicationController
render "go_import", layout: false
end
def repo_exists?
project.repository_exists? && !project.empty_repo?
end
def get_id
project.repository.root_ref
end