Fix some package registry problems (#34759)

1. Fix #33787
2. Fix container image display
This commit is contained in:
wxiaoguang
2025-06-19 00:32:43 +08:00
committed by GitHub
parent 7954f25290
commit a2ae7c69da
11 changed files with 118 additions and 60 deletions

View File

@@ -599,6 +599,12 @@ func GetPackageFileStream(ctx context.Context, pf *packages_model.PackageFile) (
return GetPackageBlobStream(ctx, pf, pb, nil)
}
func OpenBlobStream(pb *packages_model.PackageBlob) (io.ReadSeekCloser, error) {
cs := packages_module.NewContentStore()
key := packages_module.BlobHash256Key(pb.HashSHA256)
return cs.OpenBlob(key)
}
// GetPackageBlobStream returns the content of the specific package blob
// If the storage supports direct serving and it's enabled, only the direct serving url is returned.
func GetPackageBlobStream(ctx context.Context, pf *packages_model.PackageFile, pb *packages_model.PackageBlob, serveDirectReqParams url.Values) (io.ReadSeekCloser, *url.URL, *packages_model.PackageFile, error) {
@@ -617,7 +623,7 @@ func GetPackageBlobStream(ctx context.Context, pf *packages_model.PackageFile, p
}
}
if u == nil {
s, err = cs.Get(key)
s, err = cs.OpenBlob(key)
}
if err == nil {