Commit 6ad40c5
committed
fix(upload): accept onUploadInit in option validator
The `onUploadInit` callback was added to `UploadOptions` and wired
through to `cryptify.upload`, but `validateUploadOptions`'s top-level
whitelist was missed. Passing `{ onUploadInit: fn }` therefore threw
`TypeError: sealed.upload(opts): unknown option "onUploadInit"` —
breaking any consumer who tried to capture the uuid as soon as
`upload_init` resolved (e.g. postguard-website's staging email-preview
modal needs it to render the /download link before chunks finish).
Adds `onUploadInit` to `VALID_UPLOAD_KEYS`, plus a value-type check
that the callback is a function (consistent with the other "fail loud"
checks in this validator).
Tests:
- accepts a top-level `onUploadInit` function
- rejects a non-function value with a clear error1 parent d3a7168 commit 6ad40c5
2 files changed
Lines changed: 27 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
202 | 209 | | |
203 | 210 | | |
204 | 211 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
230 | 248 | | |
231 | 249 | | |
232 | 250 | | |
| |||
0 commit comments