This commit is contained in:
Kovid Goyal 2024-03-12 19:08:40 +05:30
parent 91120754a3
commit cd13fbfe27
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -108,11 +108,10 @@ class HTMLFile:
self.links = []
try:
f = case_ignoring_open_file(self.path, 'rb') if correct_case_mismatches else open(self.path, 'rb')
with (case_ignoring_open_file if correct_case_mismatches else open)(self.path, 'rb') as f:
self.path = f.name
self.base = os.path.dirname(self.path)
self.title = os.path.splitext(os.path.basename(self.path))[0]
with f:
src = header = f.read(4096)
encoding = detect_xml_encoding(src)[1]
if encoding: