fork of whitequark.org/git-pages with mods for tangled

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

authored by David Leadbeater and committed by whitequark.org b5a1626a b1b8ae26

Changed files
+1 -1
src
+1 -1
src/manifest.go
··· 148 148 } else if entry.GetType() == Type_InlineFile && entry.GetTransform() == Transform_None { 149 149 contentType := mime.TypeByExtension(filepath.Ext(path)) 150 150 if contentType == "" { 151 - contentType = http.DetectContentType(entry.Data[:512]) 151 + contentType = http.DetectContentType(entry.Data[:min(512, len(entry.Data))]) 152 152 } 153 153 entry.ContentType = proto.String(contentType) 154 154 } else {