Skip to content

Commit 42eb97d

Browse files
committed
update
1 parent f24fe88 commit 42eb97d

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

Mailman/Handlers/CookHeaders.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ def prefix_subject(mlist, msg, msgdata):
237237
# If subject is already a string, use it directly
238238
if isinstance(subject, str):
239239
subject_str = subject
240+
# If subject is a Header object, convert it to string
241+
elif isinstance(subject, Header):
242+
subject_str = str(subject)
240243
else:
241244
# Try to decode the subject
242245
try:

Mailman/Queue/IncomingRunner.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,15 +383,20 @@ def _oneloop(self):
383383
self._shunt.enqueue(msg, msgdata)
384384
continue
385385

386-
msgid = msg.get('message-id', 'n/a')
386+
# Try to get message-id early for logging purposes
387+
try:
388+
msgid = msg.get('message-id', 'n/a')
389+
except Exception as e:
390+
msgid = 'unknown'
391+
mailman_log('error', 'IncomingRunner._oneloop: Error getting message-id for file %s: %s', filebase, str(e))
387392

388393
# Get the list name
389394
listname = msgdata.get('listname', 'unknown')
390395
try:
391396
mlist = MailList.MailList(listname, lock=False)
392397
except Errors.MMUnknownListError:
393-
mailman_log('error', 'IncomingRunner._oneloop: Unknown list %s for message %s',
394-
listname, msgid)
398+
mailman_log('error', 'IncomingRunner._oneloop: Unknown list %s for message %s (file: %s)',
399+
listname, msgid, filebase)
395400
self._shunt.enqueue(msg, msgdata)
396401
continue
397402

@@ -402,14 +407,15 @@ def _oneloop(self):
402407
# If the message should be kept in the queue, requeue it
403408
if result:
404409
self._switchboard.enqueue(msg, msgdata)
405-
mailman_log('info', 'IncomingRunner._oneloop: Message requeued for later processing: %s', filebase)
410+
mailman_log('info', 'IncomingRunner._oneloop: Message requeued for later processing: %s (msgid: %s)',
411+
filebase, msgid)
406412
else:
407413
mailman_log('info', 'IncomingRunner._oneloop: Message processing complete, moving to shunt queue %s (msgid: %s)',
408414
filebase, msgid)
409415

410416
except Exception as e:
411-
mailman_log('error', 'IncomingRunner._oneloop: Error processing message: %s\n%s',
412-
str(e), traceback.format_exc())
417+
mailman_log('error', 'IncomingRunner._oneloop: Error processing message %s (file: %s): %s\n%s',
418+
msgid, filebase, str(e), traceback.format_exc())
413419
# Move to shunt queue on error
414420
self._shunt.enqueue(msg, msgdata)
415421

0 commit comments

Comments
 (0)