Commit ff866faf authored by Douwe Maan's avatar Douwe Maan

Only load tree when project has repository to prevent 404

parent aebe0ddc
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment