Ionaru / Ionaru/easy-markdown-editor
Allow absolute URLs for returned image filePaths
- Dominant language
- JavaScript
- Stars
- 3.1k
- Forks
- 363
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the problem**
If I run easyMDE on a webpage hosted at `https://www.example.com`, and my imageUploadEndpoint returns something like:
```
{
"data":
{
"filePath": "https://static.example.com/images/abc.jpg"
}
}
```
Then easyMDE will add the following markdown:
```

```
which is obviously incorrect. This is a bit frustrating, I think it's quite a typical situation for images to be hosted on a different subdomain than the main application, so support for absolute URLs is very important.
Another concrete example I encountered is that while developing and testing my API, I temporarily returned `http://placekitten.com/200/300` (some generic image placeholder showing cute kitten) when I hadn't yet implemented the methods to store the image and return the real URL. This didn't correctly work since easyMDE doesn't support absolute URLs.
**Describe the solution you'd like**
A solution is to simply detect whether the provided `filePath` is an absolute URL, in which case the current domain shouldn't be prepended.
Contributor guide
Research direction
Start by tracing the imageUploadEndpoint response handling where filePath is turned into Markdown. Check how the current domain is prepended, then verify behavior for both absolute and relative filePath values. Done means absolute URLs remain unchanged while relative paths continue to work correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100