fix: Fix runtime errors in mail app

- Fix envelopes list access: use index with bounds checking instead of .get()
- Add missing 'Any' type import to ContentContainer
- App now starts successfully without NameError or AttributeError
This commit is contained in:
Bendt
2025-12-28 12:52:23 -05:00
parent de96353554
commit 5f3fe302f1
2 changed files with 5 additions and 2 deletions

View File

@@ -270,7 +270,10 @@ class EmailViewerApp(App):
metadata = self.message_store.get_metadata(message_id) metadata = self.message_store.get_metadata(message_id)
envelope = None envelope = None
if metadata: if metadata:
envelope = self.message_store.envelopes.get(metadata["index"]) index = metadata.get("index", 0)
# Check bounds before accessing envelopes list
if 0 <= index < len(self.message_store.envelopes):
envelope = self.message_store.envelopes[index]
content_container.display_content( content_container.display_content(
message_id, folder=folder, account=account, envelope=envelope message_id, folder=folder, account=account, envelope=envelope

View File

@@ -15,7 +15,7 @@ from src.mail.notification_compressor import create_compressor
from src.mail.notification_detector import NotificationType from src.mail.notification_detector import NotificationType
import logging import logging
from datetime import datetime from datetime import datetime
from typing import Literal, List, Dict, Optional from typing import Literal, List, Dict, Any, Optional
from urllib.parse import urlparse from urllib.parse import urlparse
import re import re
import os import os