bpo-41068: Fix read after write in zipfile for non-ASCII files names. (GH-21040)
(cherry picked from commit 36ff513f82e372ed3cea0bf7cbdf15a1ef6dab9e)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index 8903d6a..915698f 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -1534,7 +1534,7 @@
# strong encryption
raise NotImplementedError("strong encryption (flag bit 6)")
- if zinfo.flag_bits & 0x800:
+ if fheader[_FH_GENERAL_PURPOSE_FLAG_BITS] & 0x800:
# UTF-8 filename
fname_str = fname.decode("utf-8")
else: