Browse Source

Post-processing would crash if there is no files to unpack

pull/1880/head
Safihre 4 years ago
parent
commit
cdd7e6931a
  1. 4
      sabnzbd/filesystem.py
  2. 5
      tests/test_filesystem.py

4
sabnzbd/filesystem.py

@ -295,8 +295,10 @@ def sanitize_and_trim_path(path: str) -> str:
def sanitize_files(folder: Optional[str] = None, filelist: Optional[List[str]] = None) -> List[str]:
"""Sanitize each file in the folder or list of filepaths, return list of new names"""
logging.info("Checking if any resulting filenames need to be sanitized")
if not filelist:
if folder:
filelist = listdir_full(folder)
else:
filelist = filelist or []
# Loop over all the files
output_filelist = []

5
tests/test_filesystem.py

@ -258,6 +258,11 @@ class TestSanitizeFiles(ffs.TestCase):
self.fs.path_separator = "\\"
self.fs.is_windows_fs = True
def test_sanitize_files_input(self):
assert [] == filesystem.sanitize_files(folder=None)
assert [] == filesystem.sanitize_files(filelist=None)
assert [] == filesystem.sanitize_files(folder=None, filelist=None)
@set_platform("win32")
@set_config({"sanitize_safe": True})
def test_sanitize_files(self):

Loading…
Cancel
Save