Attachments on tasks are overwritten

Created on 12 June 2025, 21 days ago

Problem/Motivation

It's not possible to store attachments on tasks, as they're always overwritten.

This code is currently part of Task::preSave:

   // Set attachments from comments and task.
    $files = $textHelper->grabFilesFromText($this->description->value);
    foreach ($comments as $comment) {
      $files = array_merge($files, $textHelper->grabFilesFromText($comment->comment->value));
    }
    $this->set('attachements', $files);

This ends up overwriting whatever's in the 'attachements' [typo] field already on every save, meaning it's impossible to add attachments to the task.

Steps to reproduce

  • Create a new task
  • Add a file reference to the attachments field
  • Save the task
  • Attachments field is incorrectly empty

Proposed resolution

This should merge with existing items in the field.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom jeremyskinner

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024