MCPcopy Index your code
hub / github.com/coder/coder / refineTextMediaType

Function refineTextMediaType

coderd/x/chatfiles/mime.go:224–236  ·  view source on GitHub ↗
(name string, data []byte)

Source from the content-addressed store, hash-verified

222}
223
224func refineTextMediaType(name string, data []byte) string {
225 switch strings.ToLower(filepath.Ext(name)) {
226 case ".json":
227 if json.Valid(data) {
228 return "application/json"
229 }
230 case ".md", ".markdown":
231 return "text/markdown"
232 case ".csv":
233 return "text/csv"
234 }
235 return "text/plain"
236}
237
238func truncateUTF8Bytes(value string, maxBytes int) string {
239 if maxBytes <= 0 || value == "" {

Callers 1

ClassifyStoredMediaTypeFunction · 0.85

Calls 1

ValidMethod · 0.65

Tested by

no test coverage detected