mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
91120754a3
commit
cd13fbfe27
@ -108,11 +108,10 @@ class HTMLFile:
|
|||||||
self.links = []
|
self.links = []
|
||||||
|
|
||||||
try:
|
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.path = f.name
|
||||||
self.base = os.path.dirname(self.path)
|
self.base = os.path.dirname(self.path)
|
||||||
self.title = os.path.splitext(os.path.basename(self.path))[0]
|
self.title = os.path.splitext(os.path.basename(self.path))[0]
|
||||||
with f:
|
|
||||||
src = header = f.read(4096)
|
src = header = f.read(4096)
|
||||||
encoding = detect_xml_encoding(src)[1]
|
encoding = detect_xml_encoding(src)[1]
|
||||||
if encoding:
|
if encoding:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user