remarkjs / react-markdown

Markdown component for React
https://remarkjs.github.io/react-markdown/
MIT License
13.19k stars 874 forks source link

Link URL getting encoded in react-markdown v9 #797

Closed ankurparihar closed 12 months ago

ankurparihar commented 12 months ago

Initial checklist

Affected packages and versions

9.0.0

Link to runnable example

No response

Steps to reproduce

Go to: https://remarkjs.github.io/react-markdown/

Open Network panel in DevTools

Paste this in readme

[![Test Badge](
https://github.com/remarkjs/react-markdown/workflows/main/badge.svg?v=123&branch=feat/router)](https://github.com/remarkjs/react-markdown/actions)

Observed URL: https://github.com/remarkjs/react-markdown/workflows/main/badge.svg?v=123&branch=feat/router

Notice: &, this is causing issues

Expected behavior

URL should not be double encoded

Actual behavior

URL is being encoded in a weird way.

Runtime

No response

Package manager

No response

OS

No response

Build and bundle tools

No response

wooorm commented 12 months ago

this is causing issues

It is not.

This is how HTML works.

github-actions[bot] commented 12 months ago

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.

ankurparihar commented 12 months ago

Hey @wooorm , This is causing issues due to invalid URL.

Here's a screenshot for the comparison on your own site, please have a look.

Screenshot 2023-11-13 at 2 23 25 PM

Can you please help me with a correct URL, with parameters.

ankurparihar commented 12 months ago

Never mind, I'll recreate another example. But this is breaking!

wooorm commented 12 months ago

It is not: there might be something else broken, likely on your end, of course. Feel free to try and reproduce the actual problem

ankurparihar commented 12 months ago

Ok, finally, I'm able to reproduce!

Here you can see, in the markdown I've added a normal url from official sonarqube project

Screenshot 2023-11-13 at 3 58 10 PM

You can see what's going on in network tab, the & gets converted to & and in-turn becomes an invalid query parameter.

I'm willing to contribute a fix, but I have no idea where it's getting encoded from like this.

I appreciate the effort you guys put to create the library, please help me narrow it down.

wooorm commented 12 months ago

Paste code so I can try it out

wooorm commented 12 months ago

Ohh, managed to reproduce!

github-actions[bot] commented 12 months ago

Hi team! I don’t know what’s up as there’s no phase label. Please add one so I know where it’s at.

Thanks, — bb

ankurparihar commented 12 months ago

Sorry, I was out for a while,

Here's a snippet you can try -

[![Coverage](https://next.sonarqube.com/sonarqube/api/project_badges/measure?project=sonarqube&metric=coverage&token=d95182127dd5583f57578d769b511660601a8547)](https://next.sonarqube.com/sonarqube/dashboard?id=sonarqube)

wooorm commented 12 months ago

Released in 9.0.1!

ankurparihar commented 12 months ago

Awesome, thank you so much @wooorm 🙌