From dc2d4ffb8567b55ccc09dac3e78b0fde37bacb64 Mon Sep 17 00:00:00 2001 From: shypike Date: Thu, 20 Feb 2014 22:09:32 +0100 Subject: [PATCH] Make RAR/RAR5 detection more robust. --- sabnzbd/utils/rarfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sabnzbd/utils/rarfile.py b/sabnzbd/utils/rarfile.py index 2101cf5..b4e8fc8 100644 --- a/sabnzbd/utils/rarfile.py +++ b/sabnzbd/utils/rarfile.py @@ -109,8 +109,8 @@ RAR_OS_UNIX = 3 def is_rarfile(fn): '''Check quickly whether file is rar archive.''' try: - buf = open(fn, "rb").read(len(RAR_ID)) - return buf == RAR_ID or buf == RAR5_ID + buf = open(fn, "rb").read(50) + return buf.startswith(RAR_ID) or buf.startswith(RAR5_ID) except: return False