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)
| 79 | // download-only because browser PDF viewers have a broader active-content |
| 80 | // attack surface than the other media types we allow inline. |
| 81 | func 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 |