# Bug COMMS-355 - Inline comment attachments are not linked to the comment when submit is via API

Project: Stream Communicator
Status: closed
URL: https://community.openproject.org/work_packages/COMMS-355

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module | API |
| Target versions | 16.1.1 |
| Observed in versions | 16.1.0 |
| Sprint |  |
| Backlog bucket |  |
| Bug found in version (deprecated) | 16.1.x |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable | Kabiru Mwenja |
| Product manager |  |
| Developers | Kabiru Mwenja |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### 

### Steps to reproduce

1.  Upload an attachment [**POST /api/v3/attachments**](https://www.openproject.org/docs/api/endpoints/attachments/#create-attachment) which creates an "uncontainered attachment" i.e. an attachment that is not tied to any resource such as an "Activity::Comment" or "WorkPackage"

2.  Subsequently submit a work package comment [**POST /api/v3/work\_packages/{id}/activities**](https://www.openproject.org/docs/api/endpoints/work-packages/#comment-work-package) with the comment including an inlined attachment with ID from (1)

<!-- end list -->

``` json
{
  "comment": {
    "raw": "Text before attachment\n\n<img class=\"op-uc-image op-uc-image_inline\" src=\"/api/v3/attachments/{ATTACHMENT_ID_FROM_(1)}/content\">\n\nText after attachment"
  },
  "internal": true // OPTIONAL
}
```

   3. Fetch the attachments for the comment created in (2) via [**GET /api/v3/activities/{commentID}/attachments**](https://www.openproject.org/docs/api/endpoints/activities/#list-attachments-by-activity)

### What is the buggy behavior?

  - The attachment is not part of the response in step (3) which indicates that the attachment is NOT linked to the comment albeit, visible via UI

<!-- end list -->

``` json
{
  "_type": "Collection",
  "total": 0,
  "count": 0,
  "_embedded": {
    "elements": []
  },
  "_links": {
    "self": {
      "href": "/api/v3/activities/79244/attachments"
    }
  }
}
```

### What is the expected behavior?

1.  When the user submits an inlined attachment that is "uncontainered" it is claimed for that comment and hence visible via API when retrieving a comment's attachments via [**GET /api/v3/activities/{commentID}/attachments**](https://www.openproject.org/docs/api/endpoints/activities/#list-attachments-by-activity)

### 

### 

### 

**OpenProject version**

*v16.1*
