modrinth / code

The Modrinth monorepo containing all code which powers Modrinth!
https://modrinth.com
Other
1k stars 188 forks source link

Incorrect URL Encoding for Images: Modrinth replaces "&" with "&amp%3" instead of "%26" #1570

Closed Tomate0613 closed 10 months ago

Tomate0613 commented 1 year ago

Describe the bug

When attempting to include an image in the description of a mod on Modrinth, the URL generated for the image is incorrect. The URL modification process adds the string https://wsrv.nl/?url= followed by the encoded URL, but the encoded URL is incorrect

Steps to reproduce

  1. Go to Modrinth and navigate to the mod's description editing section.
  2. Insert the following markdown syntax in the description:
    ![Requires FabricApi](https://tomate-api.vercel.app/api/dependency?mod=fabric-api&color=bcb29c)
  3. Switch to Preview
  4. The border is white because the url is incorrect

Expected behavior

The URL in the generated mod description should be: https://wsrv.nl/?url=https%3A%2F%2Ftomate-api.vercel.app%2Fapi%2Fdependency%3Fmod%3Dfabric-api%26color%3Dbcb29c&n=-1

Actual Behavior: The URL is: https://wsrv.nl/?url=https%3A%2F%2Ftomate-api.vercel.app%2Fapi%2Fdependency%3Fmod%3Dfabric-api%26amp%3Bcolor%3Dbcb29c&n=-1

Additional context

This issue occurs specifically with image URLs containing multiple query parameters in the mod description section on Modrinth. The incorrect URL encoding on Modrinth's side impacts the correct loading and display of images within the mod descriptions.

I am not sure if this is an issue on the client or server side but I assume this is the correct place to report the issue to.

Tomate0613 commented 10 months ago

Fixed :D