From e6a3cbf774d79f8ecf03da97a8106b128df92629 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Sun, 14 Apr 2024 05:17:33 -0700 Subject: [PATCH] Try to display base64 data properly in overboard. --- Rocksolid_Light/rocksolid/newsportal.php | 9 +++++++-- Rocksolid_Light/rslight/scripts/spoolnews.php | 9 ++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Rocksolid_Light/rocksolid/newsportal.php b/Rocksolid_Light/rocksolid/newsportal.php index f8f4168..5cc9e0c 100644 --- a/Rocksolid_Light/rocksolid/newsportal.php +++ b/Rocksolid_Light/rocksolid/newsportal.php @@ -1549,9 +1549,14 @@ function create_xref_from_msgid($msgid, $thisgroup = null, $thisnumber = null) return ($xref); } -function get_search_snippet($body, $content_type = '') +function get_search_snippet($body, $content_type = '', $content_transfer_encoding = null) { - $body = quoted_printable_decode($body); + if($content_transfer_encoding == 'base64') { + $body = base64_decode($body); + } + if($content_transfer_encoding == 'quoted-printable') { + $body = quoted_printable_decode($body); + } if ($content_type !== '') { $mysnippet = recode_charset($body, $content_type, "utf8"); } else { diff --git a/Rocksolid_Light/rslight/scripts/spoolnews.php b/Rocksolid_Light/rslight/scripts/spoolnews.php index e55de2f..a67c467 100644 --- a/Rocksolid_Light/rslight/scripts/spoolnews.php +++ b/Rocksolid_Light/rslight/scripts/spoolnews.php @@ -291,6 +291,7 @@ function get_articles($ns, $group) $integrity = false; $is_header = 1; $body = ""; + $content_transfer_encoding = null; while (strcmp($response, ".") != 0) { $is_xref = false; $bytes = $bytes + mb_strlen($response, '8bit'); @@ -338,6 +339,12 @@ function get_articles($ns, $group) $banned = "subject_filter"; } } + // Transfer encoding + if (stripos($response, "Content-Transfer-Encoding: ") === 0) { + $enco = explode(': ', $response, 2); + $content_transfer_encoding = $enco[1]; + } + if (stripos($response, "Newsgroups: ") === 0) { $response = str_ireplace($group, $group, $response); // Identify each group name for xref @@ -435,7 +442,7 @@ function get_articles($ns, $group) if ($CONFIG['article_database'] == '1') { unlink($articleHandle); // CREATE SEARCH SNIPPET - $this_snippet = get_search_snippet($body, $content_type[1]); + $this_snippet = get_search_snippet($body, $content_type[1], $content_transfer_encoding); } else { if ($article_date > time()) { $article_date = time();