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):
'''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

Loading…
Cancel
Save