Fix a bug with reporting posts to spamnoticer

- Posts that have deleted files were not able to be reported
as spam. Add checks in the spamnoticer code when building the request.
This commit is contained in:
towards-a-new-leftypol 2023-10-18 15:03:57 -04:00
parent 505d62d872
commit f9e8390451
1 changed files with 10 additions and 0 deletions

View File

@ -153,6 +153,11 @@ function addToSpamNoticer($config, $post, $boardname, BanFormFieldsForSpamnotice
if (isset($post->files) && is_array($post->files)) { if (isset($post->files) && is_array($post->files)) {
foreach ($post->files as $file) { foreach ($post->files as $file) {
$key = $file->file_id . '.' . $file->extension; $key = $file->file_id . '.' . $file->extension;
if (!isset($form_info->files_info[$key])) {
continue;
}
$file_info = $form_info->files_info[$key]; $file_info = $form_info->files_info[$key];
$thumb_uri $thumb_uri
= $config['spam_noticer']['imageboard_root'] = $config['spam_noticer']['imageboard_root']
@ -201,6 +206,11 @@ function addToSpamNoticer($config, $post, $boardname, BanFormFieldsForSpamnotice
if (isset($post->files) && is_array($post->files)) { if (isset($post->files) && is_array($post->files)) {
foreach ($post->files as $file) { foreach ($post->files as $file) {
$key = $file->file_id . '.' . $file->extension;
if (!isset($form_info->files_info[$key])) {
continue;
}
$filename = $board['dir'] . $config['dir']['img'] . $file->file; $filename = $board['dir'] . $config['dir']['img'] . $file->file;
$multipart[] = array( $multipart[] = array(