[bug]: Attachments fail with "Invalid file type" when browser sends empty MIME (.md/.csv/.txt on macOS)
@sangeethailango is already working on this.
Since May 8, 2026.
- Dominant language
- TypeScript
- Stars
- 59.6k
- Forks
- 5.8k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 49
Description
Description
On self-hosted Plane v1.3.0, attaching a .md, .csv, or .txt file from macOS (Edge 147 / Chromium 147) fails with HTTP 400 {"error":"Invalid file type."}.
These extensions ARE in ATTACHMENT_MIME_TYPES, so this is not an allow-list gap. The cause is that the browser's File.type is empty for these extensions on macOS (the OS UTI mapping doesn't yield a MIME), and the web client posts "type": "" to the v2 attachments endpoint. The backend then rejects it because not type is truthy.
Reproduction
Self-hosted v1.3.0, macOS, Edge 147 (Chromium).
Open an issue, click Attach.
Pick any .md, .csv, or .txt file.
Network tab shows POST to /api/assets/v2/workspaces//projects//issues//attachments/ with body {"name":"foo.md","size":N,"type":""}.
Response: 400 {"error":"Invalid file type.","status":false}.
Both .md (#8519) and .csv/.txt are affected — the #8524 fix added text/markdown to the allow-list but didn't address the empty-type case.
Suggested fix
In apps/api/plane/app/views/issue/attachment.py, fall back to mimetypes.guess_type(name)[0] when request.data.get("type") is empty:
import mimetypes
...
name = request.data.get("name")
type = request.data.get("type", False)
if not type and name:
type = mimetypes.guess_type(name)[0]
if not type or type not in settings.ATTACHMENT_MIME_TYPES:
return Response({"error": "Invalid file type.", ...}, status=400)
For belt-and-suspenders, also fix the web client to do the same fallback before constructing the upload payload.
Workaround
Patch the API container's attachment.py with the above change, or upload from a browser/OS combination that does fill in File.type for these extensions.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.