From 3c659b532269440e70b8cc6e8bc44d623cab8313 Mon Sep 17 00:00:00 2001 From: Philip Laine Date: Sat, 27 Jul 2024 13:18:51 +0200 Subject: [PATCH] Set blob content type to disable detection --- CHANGELOG.md | 1 + pkg/registry/registry.go | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0da9de50..5d1e2258 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#519](https://github.com/spegel-org/spegel/pull/519) Extend tests for containerd. - [#520](https://github.com/spegel-org/spegel/pull/520) Add tests for metrics. - [#536](https://github.com/spegel-org/spegel/pull/536) Update Go version to 1.22.5. +- [#547](https://github.com/spegel-org/spegel/pull/547) Set blob content type to disable detection. ### Deprecated diff --git a/pkg/registry/registry.go b/pkg/registry/registry.go index df952cdb..faea712b 100644 --- a/pkg/registry/registry.go +++ b/pkg/registry/registry.go @@ -334,6 +334,7 @@ func (r *Registry) handleBlob(rw mux.ResponseWriter, req *http.Request, ref refe rw.WriteError(http.StatusInternalServerError, fmt.Errorf("could not determine size of blob with digest %s: %w", ref.dgst.String(), err)) return } + rw.Header().Set("Content-Type", "application/octet-stream") rw.Header().Set("Content-Length", strconv.FormatInt(size, 10)) rw.Header().Set("Docker-Content-Digest", ref.dgst.String()) if req.Method == http.MethodHead {