From c89548c2ba41e5a591fe906baa341f0837923f66 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Fri, 18 Mar 2022 09:49:02 +0000 Subject: [PATCH] monitor: journal_newest_filename(): Check for None directory os.listdir(None) operates on '.', which is wrong in this context, so be sure to avoid that. --- monitor.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/monitor.py b/monitor.py index 4451a5b4..ea54d33f 100644 --- a/monitor.py +++ b/monitor.py @@ -268,6 +268,10 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below :param journals_dir: The directory to check :return: The `str` form of the full path to the newest Journal file """ + # os.listdir(None) returns CWD's contents + if journals_dir is None: + return None + journal_files = (x for x in listdir(journals_dir) if self._RE_LOGFILE.search(x)) if journal_files: # Odyssey Update 11 has, e.g. Journal.2022-03-15T152503.01.log