Calendar: Fix attachments duplication when moving an event using database driver

This commit is contained in:
Aleksander Machniak 2019-10-01 20:44:31 +02:00
parent 09ef4f6b8c
commit 6b89f751a7

View file

@ -1318,7 +1318,15 @@ class database_driver extends calendar_driver
*/
private function add_attachment($attachment, $event_id)
{
$data = $attachment['data'] ? $attachment['data'] : file_get_contents($attachment['path']);
if (isset($attachment['data'])) {
$data = $attachment['data'];
}
else if (!empty($attachment['path'])) {
$data = file_get_contents($attachment['path']);
}
else {
return false;
}
$query = $this->rc->db->query(
"INSERT INTO `{$this->db_attachments}`"