Browse Source

Make RAR/RAR5 detection more robust.

pull/142/head
shypike 11 years ago
parent
commit
dc2d4ffb85
  1. 4
      sabnzbd/utils/rarfile.py

4
sabnzbd/utils/rarfile.py

@ -109,8 +109,8 @@ RAR_OS_UNIX = 3
def is_rarfile(fn): def is_rarfile(fn):
'''Check quickly whether file is rar archive.''' '''Check quickly whether file is rar archive.'''
try: try:
buf = open(fn, "rb").read(len(RAR_ID)) buf = open(fn, "rb").read(50)
return buf == RAR_ID or buf == RAR5_ID return buf.startswith(RAR_ID) or buf.startswith(RAR5_ID)
except: except:
return False return False

Loading…
Cancel
Save