Try to display base64 data properly in overboard.

This commit is contained in:
Retro_Guy 2024-04-14 05:17:33 -07:00
parent c7e05a3f9d
commit e6a3cbf774
2 changed files with 15 additions and 3 deletions

View File

@ -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 {

View File

@ -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();