rcltext.py: make sure to close file (windows temp file removal)

This commit is contained in:
Jean-Francois Dockes 2019-07-20 19:09:07 +02:00
parent 7d168dc198
commit 16a051c3b6

View File

@ -31,8 +31,8 @@ class TxtDump(RclBaseHandler):
def html_text(self, fn):
# No charset, so recoll will have to use its config to guess it
html = b'<html><head><title></title></head><body><pre>'
f = open(fn, "rb")
html += self.em.htmlescape(f.read())
with open(fn, "rb") as f:
html += self.em.htmlescape(f.read())
html += b'</pre></body></html>'
return html