Title: wrong FNAME in tarfile if tgz extension is used
Type: Stage:
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9, Python 3.8, Python 3.7, Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List:
Priority: normal Keywords:

Created on 2021-06-23 06:55 by, last changed 2021-06-23 06:55 by

Messages (1)
msg396382 - (view) Author: Maciej Misiak ( Date: 2021-06-23 06:55
This code is incomplete:

def _init_write_gz(self):
    if".gz"): =[:-3]
    # RFC1952 says we must use ISO-8859-1 for the FNAME field.
    self.__write("iso-8859-1", "replace") + NUL)

If it is used in following way '.gz' is stripped properly and FNAME='somefile.tar':'somefile.tar.gz', 'w:gz')
but with'somefile.tgz', 'w:gz')

FNAME is incorrectly prepared as somefile.tgz
Date User Action Args