Fix panic for fixBrokenRepoUnits16961 (#30068) (#30100)

backport #30068

(cherry picked from commit 6d47b63be25dd23d81c8286ac993281c8099e963)
This commit is contained in:
yp05327 2024-03-26 19:20:03 +09:00 committed by Earl Warren
parent 5b6c93cc02
commit 29b352f490
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -216,6 +216,12 @@ func fixBrokenRepoUnit16961(repoUnit *repo_model.RepoUnit, bs []byte) (fixed boo
return false, nil return false, nil
} }
var cfg any
err = json.UnmarshalHandleDoubleEncode(bs, &cfg)
if err == nil {
return false, nil
}
switch repoUnit.Type { switch repoUnit.Type {
case unit.TypeCode, unit.TypeReleases, unit.TypeWiki, unit.TypeProjects: case unit.TypeCode, unit.TypeReleases, unit.TypeWiki, unit.TypeProjects:
cfg := &repo_model.UnitConfig{} cfg := &repo_model.UnitConfig{}