URI encoding in the svg function results in a broken data URI
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- frontend
Research direction
Start in packages/public-api/src/apis/ui/helpers/svg.ts at lines 51-53 and inspect how the svg helper constructs its data URI. Verify the encoding behavior across the Shreddit and Android consumers, then confirm that the resulting SVG renders instead of showing a missing-image placeholder.
Written by the indexing model from the issue text.
Description
The svg helper function calls encodeURIComponent on the provided SVG before returning it. Based on the comment above the return line, that appears to be intentional as a fix for some different issue. Encoding the data like this completely breaks the data URI, resulting in a missing image placeholder on both Shreddit and the Android app (iOS untested).
If the point of the URI encoding is to avoid issues with special characters, perhaps it would be best to instead encode it as a base64 string? From testing with local modifications, changing the return line to this appears to work as far as the SVG actually showing up is concerned:
return `data:image/svg+xml;base64,${Buffer.from(str).toString('base64')}`;
- Dominant language
- TypeScript
- Stars
- 210
- Forks
- 88
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from reddit/devvit
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 5/5 Over a week Newbie friendliness 42/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
area:tools bug good first issue help wanted priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
TaewoooPark/Motifcode#14 ·
-
bug 🐞
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
BasedHardware/omi#15320 ·
-
Difficulty 2/5 Half a day Newbie friendliness 78/100
vercel/vercel-plugin#199 ·