Commit 993006f
committed
gh-152845: Fix missing EFS flag for files with UTF-8 comments
Fix a regression introduced by gh-84353/gh-150091 where the EFS flag
was dropped or omitted when a file with an ASCII filename and a UTF-8
comment was written to an archive. This affected both newly added files
and existing files rewritten to the central directory in append mode,
causing an unexpected metadata change and leading to comment
mis-decoding.
Introduce an internal `_metadata_encoding` attribute for `ZipInfo` to
ensure that files read from an archive preserve their original encoding
and EFS flags, while newly added files now properly enforce EFS if they
contain a non-ASCII filename or comment.1 parent 6e81d21 commit 993006f
2 files changed
Lines changed: 74 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1440 | 1440 | | |
1441 | 1441 | | |
1442 | 1442 | | |
1443 | | - | |
1444 | | - | |
1445 | | - | |
1446 | | - | |
1447 | | - | |
1448 | | - | |
1449 | | - | |
1450 | | - | |
1451 | | - | |
| 1443 | + | |
1452 | 1444 | | |
1453 | 1445 | | |
1454 | 1446 | | |
| |||
5710 | 5702 | | |
5711 | 5703 | | |
5712 | 5704 | | |
5713 | | - | |
| 5705 | + | |
| 5706 | + | |
5714 | 5707 | | |
5715 | 5708 | | |
5716 | 5709 | | |
| |||
5720 | 5713 | | |
5721 | 5714 | | |
5722 | 5715 | | |
| 5716 | + | |
| 5717 | + | |
| 5718 | + | |
| 5719 | + | |
| 5720 | + | |
| 5721 | + | |
| 5722 | + | |
| 5723 | + | |
| 5724 | + | |
| 5725 | + | |
| 5726 | + | |
5723 | 5727 | | |
5724 | 5728 | | |
5725 | 5729 | | |
| |||
5774 | 5778 | | |
5775 | 5779 | | |
5776 | 5780 | | |
| 5781 | + | |
| 5782 | + | |
| 5783 | + | |
| 5784 | + | |
| 5785 | + | |
| 5786 | + | |
| 5787 | + | |
| 5788 | + | |
| 5789 | + | |
| 5790 | + | |
| 5791 | + | |
| 5792 | + | |
| 5793 | + | |
| 5794 | + | |
| 5795 | + | |
| 5796 | + | |
| 5797 | + | |
| 5798 | + | |
| 5799 | + | |
| 5800 | + | |
| 5801 | + | |
| 5802 | + | |
| 5803 | + | |
| 5804 | + | |
| 5805 | + | |
| 5806 | + | |
| 5807 | + | |
| 5808 | + | |
| 5809 | + | |
| 5810 | + | |
| 5811 | + | |
| 5812 | + | |
| 5813 | + | |
| 5814 | + | |
| 5815 | + | |
| 5816 | + | |
| 5817 | + | |
| 5818 | + | |
| 5819 | + | |
| 5820 | + | |
| 5821 | + | |
| 5822 | + | |
| 5823 | + | |
| 5824 | + | |
| 5825 | + | |
5777 | 5826 | | |
5778 | 5827 | | |
5779 | 5828 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
| 456 | + | |
456 | 457 | | |
457 | 458 | | |
458 | 459 | | |
| |||
488 | 489 | | |
489 | 490 | | |
490 | 491 | | |
| 492 | + | |
491 | 493 | | |
492 | 494 | | |
493 | 495 | | |
| |||
575 | 577 | | |
576 | 578 | | |
577 | 579 | | |
578 | | - | |
579 | | - | |
580 | | - | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
581 | 588 | | |
582 | | - | |
583 | | - | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
584 | 592 | | |
585 | 593 | | |
586 | 594 | | |
| |||
2072 | 2080 | | |
2073 | 2081 | | |
2074 | 2082 | | |
| 2083 | + | |
2075 | 2084 | | |
2076 | 2085 | | |
2077 | 2086 | | |
| |||
2286 | 2295 | | |
2287 | 2296 | | |
2288 | 2297 | | |
2289 | | - | |
| 2298 | + | |
2290 | 2299 | | |
2291 | 2300 | | |
2292 | 2301 | | |
| |||
0 commit comments