mail page rest

This commit is contained in:
alma 2025-04-21 14:57:04 +02:00
parent 1e3a8fb50f
commit 80e2d616ab

View File

@ -1586,7 +1586,6 @@ export default function CourrierPage() {
});
} catch (error) {
console.error('Error fetching email content:', error);
// Show error to user
setError('Failed to load email content. Please try again.');
return;
}
@ -1615,14 +1614,14 @@ export default function CourrierPage() {
if (!selectedEmail?.body) return '';
try {
// Now we can safely parse the full email content
// Parse the full email content
const parsed = parseFullEmail(selectedEmail.body);
let originalContent = '';
// Get the content from either HTML or text part
if (parsed.html) {
// Use the existing MIME decoding for HTML content
originalContent = decodeMIME(parsed.html, 'quoted-printable', 'utf-8');
// Use MIME decoding for HTML content
originalContent = decodeMimeContent(parsed.html);
// Convert HTML to plain text for the reply
originalContent = originalContent
@ -1650,14 +1649,12 @@ export default function CourrierPage() {
.replace(/\n{3,}/g, '\n\n')
.trim();
} else if (parsed.text) {
// Use the existing MIME decoding for plain text content
originalContent = decodeMIME(parsed.text, 'quoted-printable', 'utf-8').trim();
// Use MIME decoding for plain text content
originalContent = decodeMimeContent(parsed.text).trim();
} else {
// Fallback to raw body if parsing fails, but still try to decode it
originalContent = decodeMIME(
selectedEmail.body.replace(/<[^>]+>/g, ''),
'quoted-printable',
'utf-8'
originalContent = decodeMimeContent(
selectedEmail.body.replace(/<[^>]+>/g, '')
).trim();
}