1
0
Fork 0
forked from forgejo/forgejo

Workaround for container registry push/pull errors (#21862) (#22069)

Backport of #21862
This commit is contained in:
KN4CK3R 2022-12-10 15:22:41 +01:00 committed by GitHub
parent e93a4a0174
commit e23ad87b55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 100 additions and 4 deletions

View file

@ -6,8 +6,10 @@ package container
import (
"context"
"errors"
"fmt"
"io"
"os"
"strings"
"code.gitea.io/gitea/models/db"
@ -403,6 +405,15 @@ func createManifestBlob(ctx context.Context, mci *manifestCreationInfo, pv *pack
log.Error("Error inserting package blob: %v", err)
return nil, false, "", err
}
// FIXME: Workaround to be removed in v1.20
// https://github.com/go-gitea/gitea/issues/19586
if exists {
err = packages_module.NewContentStore().Has(packages_module.BlobHash256Key(pb.HashSHA256))
if err != nil && errors.Is(err, os.ErrNotExist) {
log.Debug("Package registry inconsistent: blob %s does not exist on file system", pb.HashSHA256)
exists = false
}
}
if !exists {
contentStore := packages_module.NewContentStore()
if err := contentStore.Save(packages_module.BlobHash256Key(pb.HashSHA256), buf, buf.Size()); err != nil {