Commit d512856
committed
fix(share): declare the resolved media type, not the stored one
Follow-on to the previous commit, and a hole that commit opened.
Widening `isMedia` to admit filename-detected media let an `application/octet-stream`
`.mp4` into the byte-range branch — but the response still declared
`contentType: file.contentType`. These responses are `nosniff`, so the browser
saw `application/octet-stream` and refused to render, and
`getSecureFileHeaders` derives disposition from that same value, so it also came
back as `attachment`. The file became seekable and still would not play. The fix
moved the failure instead of removing it.
The declared type is now resolved alongside the admission decision: the stored
type wins when it is already audio/video (more specific — `video/webm` beats a
filename guess), otherwise the filename-derived type that admitted the file.
Header and disposition both follow it.
The buffered branch sixty lines below already resolved its type this way, with a
comment naming this exact hazard. I widened the predicate without reading it.
Suite: 20951 passed. files API: 267 passed.1 parent c0dc91e commit d512856
1 file changed
Lines changed: 16 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
85 | 97 | | |
86 | 98 | | |
87 | 99 | | |
| |||
149 | 161 | | |
150 | 162 | | |
151 | 163 | | |
152 | | - | |
| 164 | + | |
153 | 165 | | |
154 | 166 | | |
155 | 167 | | |
| |||
0 commit comments