From b5a1626a107975076eb764c5053a14569b300f52 Mon Sep 17 00:00:00 2001 From: David Leadbeater Date: Fri, 21 Nov 2025 15:45:14 +1100 Subject: [PATCH] Fix content-type detection for small files Previously a <512 byte file without an extension resulted in: internal server error: runtime error: slice bounds out of range [:512] with capacity 8 --- src/manifest.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manifest.go b/src/manifest.go index c17fc99..0e27600 100644 --- a/src/manifest.go +++ b/src/manifest.go @@ -148,7 +148,7 @@ func DetectContentType(manifest *Manifest) { } else if entry.GetType() == Type_InlineFile && entry.GetTransform() == Transform_None { contentType := mime.TypeByExtension(filepath.Ext(path)) if contentType == "" { - contentType = http.DetectContentType(entry.Data[:512]) + contentType = http.DetectContentType(entry.Data[:min(512, len(entry.Data))]) } entry.ContentType = proto.String(contentType) } else {