Only load tree when project has repository to prevent 404
This commit is contained in:
parent
aebe0ddc33
commit
ff866faf2f
|
|
@ -5,7 +5,7 @@ class ProjectsController < ApplicationController
|
||||||
skip_before_action :authenticate_user!, only: [:show, :activity]
|
skip_before_action :authenticate_user!, only: [:show, :activity]
|
||||||
before_action :project, except: [:new, :create]
|
before_action :project, except: [:new, :create]
|
||||||
before_action :repository, 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
|
# Authorize
|
||||||
before_action :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer, :archive, :unarchive]
|
before_action :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer, :archive, :unarchive]
|
||||||
|
|
@ -229,6 +229,10 @@ class ProjectsController < ApplicationController
|
||||||
render "go_import", layout: false
|
render "go_import", layout: false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def repo_exists?
|
||||||
|
project.repository_exists? && !project.empty_repo?
|
||||||
|
end
|
||||||
|
|
||||||
def get_id
|
def get_id
|
||||||
project.repository.root_ref
|
project.repository.root_ref
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue