From eb641b3e358fdbf21ea3d93f630571253286408c Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Sun, 13 Oct 2019 18:18:26 -0400 Subject: [PATCH] Fix a leaking file descriptor. --- archivebox/index.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archivebox/index.py b/archivebox/index.py index 3f4ada3f..802a7f0b 100644 --- a/archivebox/index.py +++ b/archivebox/index.py @@ -186,7 +186,8 @@ def patch_links_index(link, out_dir=OUTPUT_DIR): # Patch HTML index html_path = os.path.join(out_dir, 'index.html') - html = open(html_path, 'r').read().split('\n') + with open(html_path, 'r') as html_file: + html = [line[:-1] for line in html_file] for idx, line in enumerate(html): if title and ('