Commit fcb9c28
committed
fix(worker): graceful skip when Servers or Messages data is absent
A user reported UNKNOWN_ERROR for package 4aa23a2a6ea2f52ba9016a723143b792.
Traceback:
File "/app/tasks.py", line 466, in read_analytics_file
server_content = zip.open(server_path)
KeyError: "There is no item named 'Servers/index.json' in the archive"
Same fallback bug that PR #82 fixed for the analytics path: when the
discovered root is None, the old code blindly assigned the canonical
literal 'Servers/index.json' (resp. 'Messages/index.json') and let
zip.open KeyError if that file isn't actually in the archive. That
happens when the user un-ticks 'Servers' (or 'Messages') in Discord's
data-request form.
Fix: only assign a path that actually exists in zip.namelist(); if
nothing matches, set it to None and skip the read block, marking
is_partial=True. The rest of the worker copes with empty servers /
empty channels lists (the message-CSV walker filters by
namelist anyway, so it just processes 0 channels).
After this:
- No Servers folder → no guild-scoped stats but DMs/friends/payments OK
- No Messages folder → no channel-scoped stats but server list/payments OK
- Both missing → minimal package, but no crash1 parent f3ff71d commit fcb9c28
1 file changed
Lines changed: 42 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
456 | 456 | | |
457 | 457 | | |
458 | 458 | | |
459 | | - | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
460 | 467 | | |
461 | | - | |
462 | | - | |
| 468 | + | |
| 469 | + | |
463 | 470 | | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
473 | 487 | | |
474 | 488 | | |
475 | 489 | | |
476 | 490 | | |
477 | 491 | | |
478 | 492 | | |
479 | 493 | | |
480 | | - | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
481 | 498 | | |
482 | | - | |
483 | | - | |
| 499 | + | |
| 500 | + | |
484 | 501 | | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
489 | 512 | | |
490 | 513 | | |
491 | 514 | | |
| |||
0 commit comments