# Bug OP-18936 - Defect in attachment MIME detection probably with direct uploads

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-18936

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | High |
| Module | Modules and project features / File storages |
| Target versions | 17.2.0 |
| Observed in versions | 17.2.0 |
| Sprint | 17.2.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 17.2.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

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

## Planning

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

## Costs

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

## Description

### Steps to reproduce

1.  Login to our qa-instances e.g. <https://qa.openproject-edge.com/>

2.  Go to the work package

3.  Upload a PNG image

4.  Save the description

5.  Reload the page

### What is the buggy behavior?

  - The image disappears, and the image link in the description is broken

### What is the expected behavior?

1.  The image is persisted

### Notes:

The issue is not reproducible on a local installation, it probably is a bug with direct uploads.  
JPGs are not removed.  
As a side effect of a false MIME type: Images are not exported to PDF

### **Logs**

<mention class="mention" data-id="4710" data-type="user" data-text="@Markus Kahl">@Markus Kahl</mention> found out in the logs:

``` text
Failed to finish attachment upload for:
[pod/openproject-worker-default-65dc594b89-btx8g/openproject]   * user: 288 - Andrej Testdorf
[pod/openproject-worker-default-65dc594b89-btx8g/openproject]   * container: 20916 - Task #20916: Demo
[pod/openproject-worker-default-65dc594b89-btx8g/openproject]   * attachment file name: Screenshot_2025-05-19_at_16.33.18.png
[pod/openproject-worker-default-65dc594b89-btx8g/openproject] 
[pod/openproject-worker-default-65dc594b89-btx8g/openproject] Errors:
[pod/openproject-worker-default-65dc594b89-btx8g/openproject]   The file was rejected by an automatic filter. 'application/binary' is not allowed for upload.
```

and

``` text
Performing Attachments::FinishDirectUploadJob (Job ID: 64f5d720-97ad-43f7-a463-3a93128d4dbf) from GoodJob(default) enqueued at 2026-02-23T12:27:52.871319350Z
[pod/openproject-worker-default-65dc594b89-btx8g/openproject] I, [2026-02-23T12:27:53.081015 #8]  INFO -- : [ActiveJob] [Attachments::FinishDirectUploadJob] [64f5d720-97ad-43f7-a463-3a93128d4dbf] Failed to get mime type from /tmp/op_uploaded_files/1771849673-8-0037-0423/Screenshot_2025-05-19_at_16.33.18.png: No such file or directory - file No such file or directory - file
```

### Screenshots and other files

<img class="image_resized op-uc-image op-uc-image_inline" style="width:762px;" src="/api/v3/attachments/919237/content">

### Environment information

**OpenProject installation type**

  - Hosted cloud edition

**OpenProject version**

unreleased

**Browser**

- [x] All

**Operating System**

- [x] All

**Language**

- [x] All
