Spamnoticer - more guards against null files field

This commit is contained in:
towards-a-new-leftypol 2023-10-11 13:54:51 -04:00
parent 18f63222f8
commit 505d62d872
1 changed files with 8 additions and 6 deletions

View File

@ -199,6 +199,7 @@ function addToSpamNoticer($config, $post, $boardname, BanFormFieldsForSpamnotice
'contents' => json_encode($json_payload) 'contents' => json_encode($json_payload)
); );
if (isset($post->files) && is_array($post->files)) {
foreach ($post->files as $file) { foreach ($post->files as $file) {
$filename = $board['dir'] . $config['dir']['img'] . $file->file; $filename = $board['dir'] . $config['dir']['img'] . $file->file;
@ -207,6 +208,7 @@ function addToSpamNoticer($config, $post, $boardname, BanFormFieldsForSpamnotice
'contents' => GuzzleHttp\Psr7\Utils::tryFopen($filename, 'r') 'contents' => GuzzleHttp\Psr7\Utils::tryFopen($filename, 'r')
); );
} }
}
$response = $client->request('POST', '/add_post_to_known_spam', [ $response = $client->request('POST', '/add_post_to_known_spam', [