Spaces in file names are replaced_with_underscores for markdown alt tag
I often take screenshots and directly name them with a description like: "Popup not aligned with button.png".
When I attach it in GitLab, it embeds it to this, without filename (correct) but with spaces to underscores:
Steps to reproduce
- Open an issue or comment on an issue
- Attach an image with spaces in the filename
- Check the result
See the difference right here:
What is the current bug behavior?
When I attach an image with spaces in the filenam in a GitLab issue, it embeds it to this, without file extension (correct) but with spaces to underscores:
What is the expected correct behavior?
GitHub for example does not mess with the filename, just cuts the extension:
![Popup not aligned with button](…)
This is desirable, as it is like the HTML
alt="…" tag which is displayed when the image is still loading, does not load, or is read by screenreaders. Underscores have no place there.
Do it like GitHub, and don’t replace the spaces in filename with underscores for the alt text. It’s fine to do it for the upload filename, but not for the alt text.