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

Function IsInlineRenderableStoredMediaType

coderd/x/chatfiles/mime.go:81–87  ·  view source on GitHub ↗

IsInlineRenderableStoredMediaType reports whether a stored chat file may be served with Content-Disposition: inline. PDFs remain storable but download-only because browser PDF viewers have a broader active-content attack surface than the other media types we allow inline.

(mediaType string)

Source from the content-addressed store, hash-verified

79// download-only because browser PDF viewers have a broader active-content
80// attack surface than the other media types we allow inline.
81func IsInlineRenderableStoredMediaType(mediaType string) bool {
82 mediaType = BaseMediaType(mediaType)
83 if !IsAllowedStoredMediaType(mediaType) {
84 return false
85 }
86 return mediaType != "application/pdf"
87}
88
89// NormalizeStoredFileName trims surrounding whitespace, strips control
90// characters, and truncates the name to the durable storage byte limit

Callers 2

chatFileByIDMethod · 0.92

Calls 2

BaseMediaTypeFunction · 0.85
IsAllowedStoredMediaTypeFunction · 0.85

Tested by 1