dart-lang / markdown

A Dart markdown library
https://pub.dev/packages/markdown
BSD 3-Clause "New" or "Revised" License
455 stars 200 forks source link

Image links breaks due to incorrect encoding #616

Closed SlickSlime closed 5 months ago

SlickSlime commented 5 months ago

Issue: If the image link's path contains encoded string then it is incorrected decoded

Example Image Link (as obtained from uploading image to Firebase Storage)

https://firebasestorage.googleapis.com/v0/b/firebase-project-e0ea5.appspot.com/o/user%2FywBGcvstMDfk0Jnzqr41RtezZiV2%2Fblogpost%2F1718712016571.png"></p>

The ImageSyntax.createNode calls the normalizeLinkDestination utility method that converts the above image link into:

https://firebasestorage.googleapis.com/v0/b/firebase-project-e0ea5.appspot.com/o/user/ywBGcvstMDfk0Jnzqr41RtezZiV2/blogpost/1718712016571.png"></p>

Notice that the %2F was incorrect converted into /.


I noticed this issue while using the flutter_quill package where I convert the HTML document into a Quill Delta JSON document. I have opened a related issue here but regardless of that I suspect the image link should be decoded correctly in the markdown package itself.

SlickSlime commented 5 months ago

I noticed that in the main branch this issue has been resolved as per 8d07abc6bce001b000097eca35c2f5e37538702a this commit so I am closing the issue.