Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1440df2

Browse files
committed
Merged revisions 75935 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r75935 | lars.gustaebel | 2009-10-29 10:15:00 +0100 (Thu, 29 Oct 2009) | 3 lines Issue #4750: Store the basename of the original filename in the gzip FNAME header as required by RFC 1952. ........
1 parent 2ee28c9 commit 1440df2

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Lib/gzip.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# based on Andrew Kuchling's minigzip.py distributed with the zlib module
77

8-
import struct, sys, time
8+
import struct, sys, time, os
99
import zlib
1010
import builtins
1111

@@ -158,7 +158,8 @@ def _write_gzip_header(self):
158158
try:
159159
# RFC 1952 requires the FNAME field to be Latin-1. Do not
160160
# include filenames that cannot be represented that way.
161-
fname = self.name.encode('latin-1')
161+
fname = os.path.basename(self.name)
162+
fname = fname.encode('latin-1')
162163
if fname.endswith(b'.gz'):
163164
fname = fname[:-3]
164165
except UnicodeEncodeError:

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ C-API
120120
Library
121121
-------
122122

123+
- Issue #4750: Store the basename of the original filename in the gzip FNAME
124+
header as required by RFC 1952.
125+
123126
- Issue #1180: Added a new global option to ignore ~/.pydistutils.cfg in
124127
Distutils.
125128

0 commit comments

Comments
 (0)