mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2026-03-12 17:07:23 +01:00
Fixed SIM115 (open-file-with-context-handler): Use a context manager for opening files
This commit is contained in:
@@ -72,7 +72,7 @@ def scan_files(collector):
|
||||
if not os.path.exists(fn):
|
||||
continue
|
||||
if fn[-3:] == '.gz':
|
||||
tmp_file = tempfile.NamedTemporaryFile()
|
||||
with tempfile.NamedTemporaryFile(delete=False) as tmp_file:
|
||||
with gzip.open(fn, 'rb') as f:
|
||||
shutil.copyfileobj(f, tmp_file)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user