From dc10594d7b0f01cee5114789fa95c05596fe6d1e Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 18 Jul 2017 12:56:23 -0400 Subject: [PATCH] repo: fix cannot fork repository (#4572) Should not load attributes if repository not found in HasForkedRepo. --- gogs.go | 2 +- models/repo.go | 4 +++- templates/.VERSION | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gogs.go b/gogs.go index 6761e3d30..11267edde 100644 --- a/gogs.go +++ b/gogs.go @@ -16,7 +16,7 @@ import ( "github.com/gogits/gogs/pkg/setting" ) -const APP_VER = "0.11.26.0714" +const APP_VER = "0.11.27.0718" func init() { setting.AppVer = APP_VER diff --git a/models/repo.go b/models/repo.go index 5a4deba43..d6205ca53 100644 --- a/models/repo.go +++ b/models/repo.go @@ -2262,8 +2262,10 @@ func HasForkedRepo(ownerID, repoID int64) (*Repository, bool, error) { has, err := x.Where("owner_id = ? AND fork_id = ?", ownerID, repoID).Get(repo) if err != nil { return nil, false, err + } else if !has { + return nil, false, nil } - return repo, has, repo.LoadAttributes() + return repo, true, repo.LoadAttributes() } // ForkRepository creates a fork of target repository under another user domain. diff --git a/templates/.VERSION b/templates/.VERSION index f9caef96c..b4c1f0c8b 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.11.26.0714 \ No newline at end of file +0.11.27.0718 \ No newline at end of file