From c6179b0064ee535bb8070df65241ddbac3325423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Sun, 6 Sep 2015 18:26:15 +0200 Subject: [PATCH] Tweaked CBZ detection --- kcc/rarfile.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kcc/rarfile.py b/kcc/rarfile.py index 567f5ce..afb19a7 100644 --- a/kcc/rarfile.py +++ b/kcc/rarfile.py @@ -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: