Commit c0dc91e
committed
fix(share): close two holes in the public content route
Both from Cursor, both real, both in the byte-range work rather than the view
migration.
**The per-share ceiling was bypassable with any non-start Range.** The limit was
gated on `isReadStart(range)` so a player scrubbing a video would not 429 every
other visitor to the link. But that predicate was read before knowing whether
the file was media, and only media honours `Range` — every other response
ignores the header and returns the whole body. So `Range: bytes=1-` on a shared
PDF took the full download and never touched the share budget.
The exemption now applies only where the response actually is byte-served.
Media still gets its free seeks; everything else is charged unconditionally.
**Shares classified media differently than the workspace does.** This route
keyed off the stored `file.contentType`; `serve/[...path]` keys off
`getContentType(displayName)`. Uploads routinely land as
`application/octet-stream`, so a shared `.mp4` fell out of the byte-range branch,
lost `Accept-Ranges`, and could not be scrubbed — while the identical file stayed
seekable inside the workspace. Now classified by filename as well as stored type,
which is a superset of what the workspace path accepts, so nothing that is
seekable there is unseekable here.
`rangeHeader` is read once at the top now instead of twice, since both the limit
decision and the audit row need it.
Suite: 20951 passed. files API: 267 passed.1 parent ce234f4 commit c0dc91e
1 file changed
Lines changed: 23 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
71 | 86 | | |
72 | 87 | | |
73 | 88 | | |
| |||
77 | 92 | | |
78 | 93 | | |
79 | 94 | | |
80 | | - | |
81 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
82 | 101 | | |
83 | | - | |
| 102 | + | |
84 | 103 | | |
85 | 104 | | |
86 | 105 | | |
87 | 106 | | |
88 | | - | |
89 | | - | |
90 | 107 | | |
91 | 108 | | |
92 | 109 | | |
93 | 110 | | |
94 | 111 | | |
95 | 112 | | |
96 | | - | |
| 113 | + | |
97 | 114 | | |
98 | 115 | | |
99 | 116 | | |
100 | | - | |
101 | | - | |
102 | 117 | | |
103 | 118 | | |
104 | 119 | | |
| |||
0 commit comments