Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix partial percent encoded links in markdown images #1572

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

hjiangsu
Copy link
Member

@hjiangsu hjiangsu commented Oct 4, 2024

Pull Request Description

This is a small PR which fixes an issue mentioned in the following post: https://lemmy.world/post/20288898. The reason why the image was failing to load properly was due to a partially encoded string.

Note: the markdown/image library that we use already handles encoding for URLs - this is a special case where the URL was only partially encoded.

The problematic string that was passed down to the markdown widget was https://upload.wikimedia.org/wikipedia/commons/4/44/Trať_u_osady_Luh_%28u_Bezpráví%29_1.jpg

  • This is a partially encoded URL as %28 and %29 correspond to ( and ) respectively. However, all other non-ASCII characters were not percent-encoded

The fix here is to perform full decoding on the URL before passing it to our image library. The image library should automatically handle encoding!

Issue Being Fixed

Issue Number: N/A

Screenshots / Recordings

Before After
simulator_screenshot_DADD9979-8E1D-466C-AA41-9F5523D3F9C2 simulator_screenshot_9215BDEB-05C9-4A8B-9F77-E059B760F495

Checklist

  • If a new package was added, did you ensure it uses an appropriate license and is actively maintained?
  • Did you use localized strings (and added appropriate descriptions) where applicable?
  • Did you add semanticLabels where applicable for accessibility?

Copy link
Member

@micahmo micahmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix!

@hjiangsu hjiangsu merged commit 0b15d7c into develop Oct 7, 2024
1 check passed
@hjiangsu hjiangsu deleted the fix/markdown-image-non-ascii branch October 7, 2024 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants