1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-13 09:46:25 +00:00

Tweaked CBZ detection

This commit is contained in:
Paweł Jastrzębski
2015-09-06 18:26:15 +02:00
parent 1d4319be2e
commit c6179b0064

View File

@@ -360,9 +360,8 @@ class RarCannotExec(RarExecError):
def is_rarfile(xfile):
'''Check quickly whether file is rar archive.'''
fd = XFile(xfile)
buf = fd.read(len(RAR_ID))
fd.close()
with open(xfile, 'rb') as fh:
buf = fh.read(len(RAR_ID))
if buf == RAR_ID or buf == RAR5_ID:
return True
else: