#Encoded images don't work

3 messages · Page 1 of 1 (latest)

novel saffron
#

In a content collection markdown file, I have:

![](../../assets/Pasted%20image%2020231209140741.png)

the assets directory is contained within src/assets/.

When I open my post, I get this error - "Could not find requested image ../../assets/Pasted%20image%2020231209140741.png. Does it exist?". If the file doesn't have any spaces, it works fine.
If the spaces aren't encoded as %20, then they don't show up at all as <img> tags and instead I see the raw markdown in the html

rose orbitBOT
#

Hi @novel saffron. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the knowledge sources provided, it seems that Astro has had issues with file names containing spaces in the past. In one of the Github issues (https://github.com/withastro/astro/issues/5640), a user mentioned that file names with spaces were causing problems. However, the knowledge sources do not provide a direct solution to your problem.

As a workaround, you might want to consider renaming your image files to remove spaces. This could potentially solve the issue you're facing.

For future reference, it's generally a good practice to avoid spaces in file names when working with web development, as they can cause issues like the one you're experiencing. Instead, you can use hyphens (-) or underscores (_) to separate words in your file names.

If the issue persists, I would recommend raising an issue in the Astro GitHub repository for further assistance.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: