diff options
author | zeripath <art27@cantab.net> | 2022-01-08 02:03:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-08 10:03:51 +0800 |
commit | 832f987d80d0eb1dca8fb764359e8fe5d2fbbb57 (patch) | |
tree | 85200e026ec711c40e107deb153fda22d60fda3e /modules | |
parent | 69a4bd02f0546532e4f8f8e0e2e7f76d1a98de81 (diff) | |
download | gitea-832f987d80d0eb1dca8fb764359e8fe5d2fbbb57.tar.gz gitea-832f987d80d0eb1dca8fb764359e8fe5d2fbbb57.zip |
Restore setting of ctx.Repo.Mirror (#18205)
In #17933 repoAssignment no longer sets the ctx.Repo.Mirror field meaning that
attempting change mirror settings results in an NPE. This PR simply restores this.
Either we should remove this field or, we should set it. At present it seems simplest
to set it instead of going looking in the Data for the value although converting the
context to a bag of things may be the correct approach in the future.
Fix #18204
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/context/repo.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go index e259168d56..bf782383b5 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -366,14 +366,14 @@ func repoAssignment(ctx *Context, repo *repo_model.Repository) { if repo.IsMirror { var err error - mirror, err := repo_model.GetMirrorByRepoID(repo.ID) + ctx.Repo.Mirror, err = repo_model.GetMirrorByRepoID(repo.ID) if err != nil { ctx.ServerError("GetMirrorByRepoID", err) return } - ctx.Data["MirrorEnablePrune"] = mirror.EnablePrune - ctx.Data["MirrorInterval"] = mirror.Interval - ctx.Data["Mirror"] = mirror + ctx.Data["MirrorEnablePrune"] = ctx.Repo.Mirror.EnablePrune + ctx.Data["MirrorInterval"] = ctx.Repo.Mirror.Interval + ctx.Data["Mirror"] = ctx.Repo.Mirror } pushMirrors, err := repo_model.GetPushMirrorsByRepoID(repo.ID) |