atom / markdown-preview

📝 Markdown preview in Atom
MIT License
1.23k stars 358 forks source link

"#" In image path – breaks image preview #568

Open retromore opened 5 years ago

retromore commented 5 years ago

Prerequisites

Description

When path to an image contains '#' – the image in not rendered in preview.

Failed to load resource: net::ERR_FILE_NOT_FOUND /C:/Users/name/Desktop/md/#img\my_image.png

The md looks like this: ![alt-text](#img/my_image.png)

It might be even: ![alt-text](img/my_image.png)

but if '#' is present somewhere in the path, the image gets lost on the way. for example: /C:/Users/name/Desktop/#some_path/md/img\my_image.png

Steps to Reproduce

Insert an image with path containing '#'

Expected behavior:

The image should show up in preview

Actual behavior:

The image does not show up

Reproduces how often: Always

Versions

1.38.2 x64 Windows 8.1

Additional Information

Might be related to #505?

rsese commented 5 years ago

Thanks for the report -

Failed to load resource: net::ERR_FILE_NOT_FOUND /C:/Users/name/Desktop/md/#img\my_image.png

The md looks like this: ![alt-text](#img/my_image.png)

Just to clarify, you have a directory called #img? If you encode the # with %23 does that work? E.g. ![alt-text](%23img/my_image.png).

retromore commented 5 years ago

If you encode the # with %23 does that work?

Ah, yes, encoding it this way actually works.

But I noticed it when '#' was outside my relative path. My link simply was img/my_img.png So in order to make it work I'd have insert something like /C:/Users/name/Desktop/%23some_path/md/img\my_image.png – which is messy and inconvenient and will break if I move my directory elsewhere.

Is it still a bug?