diff options
author | Unknwon <u@gogs.io> | 2017-07-18 12:56:23 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-07-18 12:56:23 -0400 |
commit | dc10594d7b0f01cee5114789fa95c05596fe6d1e (patch) | |
tree | 189e0248ed082195afbeb95b35ae5270be5609ca | |
parent | e02fac4968574694927859105e67aac3f665481d (diff) |
repo: fix cannot fork repository (#4572)
Should not load attributes if repository not found in HasForkedRepo.
-rw-r--r-- | gogs.go | 2 | ||||
-rw-r--r-- | models/repo.go | 4 | ||||
-rw-r--r-- | templates/.VERSION | 2 |
3 files changed, 5 insertions, 3 deletions
@@ -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 5a4deba4..d6205ca5 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 f9caef96..b4c1f0c8 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 |