Creating a text or Markdown file with a `.png` extension results in an invalid image file
- Dominant language
- Go
- Stars
- 2.1k
- Forks
- 274
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 103
Description
## Description
When creating a new **Plain Text** or **Markdown** file, it is possible to change the file extension to `.png` before saving.
For example:
1. Create a new **Plain Text** or **Markdown** file.
2. Rename `text.txt` or `text.md` to `text.png`.
3. Enter text content and save the file.
After saving, the file is treated as an image instead of a text file. Opening it results in the following error:
> Failed to load "text.png"
The file contains text content but is handled as a PNG image based only on its extension.
## Expected Result
- The file type should be validated before saving.
- Users should not be able to save a text or Markdown file with an incompatible `.png` extension, or the application should warn the user that the file content does not match the selected extension.
---
### Screen-cast
https://github.com/user-attachments/assets/74720ac5-fa77-4520-936a-22eb710373c3
Contributor guide
Research direction
Reproduce the issue by creating a Plain Text or Markdown file, changing its extension to .png, entering text, and saving it. Trace the save and file-type handling from that workflow; done means incompatible content and extension are rejected or clearly warned about, and the resulting file is not treated as a PNG.
Written by the indexing model from the issue text.
Assessment
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100