mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-14 00:04:24 +00:00
Also test attachments.
This commit is contained in:
@@ -170,14 +170,19 @@ class AttachmentRepository implements AttachmentRepositoryInterface
|
||||
*/
|
||||
public function update(Attachment $attachment, array $data): Attachment
|
||||
{
|
||||
$attachment->title = $data['title'];
|
||||
if (array_key_exists('title', $data)) {
|
||||
$attachment->title = $data['title'];
|
||||
}
|
||||
|
||||
// update filename, if present and different:
|
||||
if (isset($data['filename']) && '' !== $data['filename'] && $data['filename'] !== $attachment->filename) {
|
||||
$attachment->filename = $data['filename'];
|
||||
if (array_key_exists('filename', $data)) {
|
||||
if ('' !== (string)$data['filename'] && $data['filename'] !== $attachment->filename) {
|
||||
$attachment->filename = $data['filename'];
|
||||
}
|
||||
}
|
||||
$attachment->save();
|
||||
$this->updateNote($attachment, $data['notes'] ?? '');
|
||||
if (array_key_exists('notes', $data)) {
|
||||
$this->updateNote($attachment, (string)$data['notes']);
|
||||
}
|
||||
|
||||
return $attachment;
|
||||
}
|
||||
|
Reference in New Issue
Block a user