From afe46aab24bf5b6c9aa34c19041a6aee0bfd4293 Mon Sep 17 00:00:00 2001 From: DanielPerkins7 Date: Tue, 1 Aug 2023 14:53:03 +0000 Subject: [PATCH] Check if item is a file when using directory queue This fixes issues with the item count being wrong and whole directories being passed on to the sender. --- ssm/message_directory.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ssm/message_directory.py b/ssm/message_directory.py index b7a70c65..667ea8e8 100644 --- a/ssm/message_directory.py +++ b/ssm/message_directory.py @@ -110,7 +110,10 @@ def _get_messages(self, sort_by_mtime=False): for (file_name, _mtime) in sorted(unsorted_messages, key=lambda tup: tup[1]): # Store the sorted file paths in a class element. - sorted_messages.append(file_name) + if os.path.isfile(file_name): + sorted_messages.append(file_name) + else: + continue # Return the sorted list. return sorted_messages