Commit 9ca8168
feat(frontend): add folder upload support (#1042)
## Summary
- Adds a **Folder** tab to the upload modal alongside File and URL
- Uploads all files sequentially, preserving directory structure under
`file-uploads/`
- Validates per-file (10MB) and total folder (100MB) size limits with
hard errors
- Adds `sanitizeRelativePath` with path traversal protection and depth
limit (20 levels)
- 13 tests passing (3 new folder validation tests)
## Test plan
- [ ] Select a folder with mixed file sizes — all upload correctly
- [ ] Select a folder with a file >10MB — hard error shown
- [ ] Select a folder totaling >100MB — hard error shown
- [ ] Single file and URL upload still work as before
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Ambient Code Bot <bot@ambient-code.local>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 02b2a7d commit 9ca8168
File tree
4 files changed
+374
-38
lines changed- components/frontend/src/app
- api/projects/[name]/agentic-sessions/[sessionName]/workspace/upload
- projects/[name]/sessions/[sessionName]
- components/modals
- __tests__
4 files changed
+374
-38
lines changedcomponents/frontend/src/app/api/projects/[name]/agentic-sessions/[sessionName]/workspace/upload/route.ts
100644100755Lines changed: 44 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
40 | 55 | | |
41 | 56 | | |
42 | 57 | | |
| |||
318 | 333 | | |
319 | 334 | | |
320 | 335 | | |
321 | | - | |
| 336 | + | |
| 337 | + | |
322 | 338 | | |
323 | 339 | | |
324 | 340 | | |
325 | 341 | | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
326 | 350 | | |
327 | 351 | | |
328 | | - | |
| 352 | + | |
329 | 353 | | |
330 | 354 | | |
331 | 355 | | |
| |||
362 | 386 | | |
363 | 387 | | |
364 | 388 | | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
365 | 403 | | |
366 | 404 | | |
367 | 405 | | |
| |||
416 | 454 | | |
417 | 455 | | |
418 | 456 | | |
419 | | - | |
| 457 | + | |
420 | 458 | | |
421 | 459 | | |
422 | 460 | | |
| |||
430 | 468 | | |
431 | 469 | | |
432 | 470 | | |
433 | | - | |
| 471 | + | |
434 | 472 | | |
435 | 473 | | |
436 | 474 | | |
| |||
518 | 556 | | |
519 | 557 | | |
520 | 558 | | |
521 | | - | |
| 559 | + | |
522 | 560 | | |
523 | 561 | | |
524 | 562 | | |
| |||
532 | 570 | | |
533 | 571 | | |
534 | 572 | | |
535 | | - | |
| 573 | + | |
536 | 574 | | |
537 | 575 | | |
538 | 576 | | |
| |||
Lines changed: 110 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
13 | 45 | | |
14 | 46 | | |
15 | 47 | | |
| |||
39 | 71 | | |
40 | 72 | | |
41 | 73 | | |
42 | | - | |
43 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
44 | 77 | | |
45 | 78 | | |
46 | 79 | | |
| |||
119 | 152 | | |
120 | 153 | | |
121 | 154 | | |
122 | | - | |
| 155 | + | |
123 | 156 | | |
124 | 157 | | |
125 | 158 | | |
| |||
128 | 161 | | |
129 | 162 | | |
130 | 163 | | |
131 | | - | |
| 164 | + | |
132 | 165 | | |
133 | 166 | | |
134 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
135 | 241 | | |
0 commit comments