Merge pull request #14673 from annando/issue-14275

Issue 14275: Avoid "Data too long" error
This commit is contained in:
Philipp 2025-01-05 22:03:55 +00:00 committed by GitHub
commit 07c4e606e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -323,6 +323,7 @@ class Photo
$values = array_fill(0, count($fields), '');
$photo = array_combine($fields, $values);
$photo['data'] = $image_data;
$photo['type'] = $mimetype ?: Images::getMimeTypeByData($image_data);
$photo['cacheable'] = false;
@ -476,6 +477,8 @@ class Photo
'backend-ref' => $backend_ref
];
$fields = DI::dbaDefinition()->truncateFieldsForTable('photo', $fields);
if (DBA::isResult($existing_photo)) {
$r = DBA::update('photo', $fields, ['id' => $existing_photo['id']]);
} else {