feat(storage): Add support for content-types (GCS only)
Extends storage.Persist to accept a Content-Type argument, which in the GCS backend is persisted with the object to ensure that the object is served back with this content-type. This is not yet implemented for the filesystem backend, where the parameter is simply ignored. This should help in the case of clients which expect the returned objects to have content-types set when, for example, fetching layers by digest.
This commit is contained in:
parent
8a5c446bab
commit
cc35bf0fc3
7 changed files with 34 additions and 13 deletions
|
|
@ -38,6 +38,7 @@ import (
|
|||
"github.com/google/nixery/builder"
|
||||
"github.com/google/nixery/config"
|
||||
"github.com/google/nixery/logs"
|
||||
mf "github.com/google/nixery/manifest"
|
||||
"github.com/google/nixery/storage"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
|
@ -170,7 +171,7 @@ func (h *registryHandler) serveManifestTag(w http.ResponseWriter, r *http.Reques
|
|||
path := "layers/" + sha256sum
|
||||
ctx := context.TODO()
|
||||
|
||||
_, _, err = h.state.Storage.Persist(ctx, path, func(sw io.Writer) (string, int64, error) {
|
||||
_, _, err = h.state.Storage.Persist(ctx, path, mf.ManifestType, func(sw io.Writer) (string, int64, error) {
|
||||
// We already know the hash, so no additional hash needs to be
|
||||
// constructed here.
|
||||
written, err := sw.Write(manifest)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue