]> source.dussan.org Git - gitea.git/commitdiff
Resolve panic on failed interface conversion in migration v156 (#15604)
authortechknowlogick <techknowlogick@gitea.io>
Sat, 24 Apr 2021 03:14:39 +0000 (23:14 -0400)
committerGitHub <noreply@github.com>
Sat, 24 Apr 2021 03:14:39 +0000 (11:14 +0800)
go panics otherwise with `panic: interface conversion: error is git.ErrNotExist, not *git.ErrNotExist`, thanks to Codeberg/Andi for reporting this.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
models/migrations/v156.go

index 9b63691a0fef0b7a831c0af3f1b26b5952528009..1e7cf282774b3e30d23abf965b339e6797bffb8e 100644 (file)
@@ -119,7 +119,7 @@ func fixPublisherIDforTagReleases(x *xorm.Engine) error {
                        commit, err := gitRepo.GetTagCommit(release.TagName)
                        if err != nil {
                                if git.IsErrNotExist(err) {
-                                       log.Warn("Unable to find commit %s for Tag: %s in %-v. Cannot update publisher ID.", err.(*git.ErrNotExist).ID, release.TagName, repo)
+                                       log.Warn("Unable to find commit %s for Tag: %s in %-v. Cannot update publisher ID.", err.(git.ErrNotExist).ID, release.TagName, repo)
                                        continue
                                }
                                log.Error("Error whilst getting commit for Tag: %s in %-v.", release.TagName, repo)