Browse Source

Add additional unrar output when checking passworded files

pull/1896/head
Safihre 4 years ago
parent
commit
0b1f7827fc
  1. 3
      sabnzbd/assembler.py
  2. 3
      sabnzbd/misc.py

3
sabnzbd/assembler.py

@ -36,7 +36,6 @@ from sabnzbd.filesystem import (
has_win_device,
diskspace,
get_filename,
get_ext,
has_unwanted_extension,
)
from sabnzbd.constants import Status, GIGI, MAX_ASSEMBLER_QUEUE
@ -354,7 +353,7 @@ def check_encrypted_and_unwanted_files(nzo: NzbObject, filepath: str) -> Tuple[b
except rarfile.RarCRCError as e:
# CRC errors can be thrown for wrong password or
# missing the next volume (with correct password)
if "cannot find volume" in str(e).lower():
if match_str(str(e), ("cannot find volume", "unexpected end of archive")):
# We assume this one worked!
password_hit = password
break

3
sabnzbd/misc.py

@ -975,8 +975,9 @@ def get_base_url(url: str) -> str:
def match_str(text: AnyStr, matches: Tuple[AnyStr, ...]) -> Optional[AnyStr]:
"""Return first matching element of list 'matches' in 'text', otherwise None"""
text = text.lower()
for match in matches:
if match in text:
if match.lower() in text:
return match
return None

Loading…
Cancel
Save