1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-01-19 01:24:05 +01:00

Merge pull request #779 from Zankaria/ban-query-truncate

Fix new_ban failing due to the message body being too big
This commit is contained in:
Lorenzo Yario 2024-08-03 23:16:11 -07:00 committed by GitHub
commit d78f865645
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -365,6 +365,14 @@ class Bans {
openBoard($post['board']);
$post['board'] = $board['uri'];
/*
* The body can be so long to make the json longer than 64KBs, causing the query to fail.
* Truncate it to a safe length (32KBs). It could probably be longer, but if the deleted body is THAT big
* already, the likelihood of it being just assorted spam/garbage is about 101%.
*/
// We're on UTF-8 only, right...?
$post['body'] = mb_strcut($post['body'], 0, 32768);
$query->bindValue(':post', json_encode($post));
} else
$query->bindValue(':post', null, PDO::PARAM_NULL);