Commit e2ef9df
authored
Fix forwarded media from private channels showing broken placeholder (#126)
* Fix forwarded media from private channels producing broken records
When a message is forwarded from a private channel and contains a
document, media.document is None. The _get_media_type() method
incorrectly returned "document" for this case because the fallback
return was outside the `if media.document` block, causing
telegram_file_id to become the string "None" and downloads to fail
permanently.
Move `return "document"` inside the truthy branch and return None
when the document reference is inaccessible. Add a safety guard in
_process_media to catch any remaining str("None") file IDs.
Fixes #125
* Update tests to match new _get_media_type behavior for null documents
Tests now assert None instead of "document" when media.document is None,
matching the fix for forwarded media from private channels.1 parent d76873a commit e2ef9df
4 files changed
Lines changed: 17 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
519 | | - | |
| 519 | + | |
| 520 | + | |
520 | 521 | | |
521 | 522 | | |
522 | 523 | | |
| |||
572 | 573 | | |
573 | 574 | | |
574 | 575 | | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
575 | 580 | | |
576 | 581 | | |
577 | 582 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1313 | 1313 | | |
1314 | 1314 | | |
1315 | 1315 | | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
1316 | 1320 | | |
1317 | 1321 | | |
1318 | 1322 | | |
| |||
1483 | 1487 | | |
1484 | 1488 | | |
1485 | 1489 | | |
1486 | | - | |
| 1490 | + | |
| 1491 | + | |
1487 | 1492 | | |
1488 | 1493 | | |
1489 | 1494 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
436 | | - | |
| 436 | + | |
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
442 | | - | |
| 442 | + | |
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
917 | 917 | | |
918 | 918 | | |
919 | 919 | | |
920 | | - | |
921 | | - | |
| 920 | + | |
| 921 | + | |
922 | 922 | | |
923 | 923 | | |
924 | | - | |
| 924 | + | |
925 | 925 | | |
926 | 926 | | |
927 | 927 | | |
| |||
0 commit comments