The discussion revolves around obtaining the real URL of uploaded files via the Discourse API. keff is trying to render raw post content in a custom front-end but images are passed as uploads://<id>.png which the browser cannot fetch.
RGJ suggests referring to a meta topic for a solution. keff attempts to use the provided Python example but encounters decoding issues. However, keff eventually resolves the problem, realizing it was due to incorrect casing.
keff shares a successful implementation of the code in Flutter, using the base_x and hex packages to decode the uploads link. The solution involves decoding the base62 encoded string and then converting it to hexadecimal.
Hey there!
I have been looking all over the internet for this but had no luck, so I resorted to asking here.
Let me add a bit of context, we are creating a custom front-end using the Discourse user API. Where I was trying to render a post raw content, but images are passed like this: uploads://<id>.png so the browser can’t fetch them.
Is there any way of getting the real URL via the API? like https://custom.discourse.org/uploads/<id>.png or something of the like?
This is the code I ended up trying. It should decode to “77f164006403e10d7d40143d525f8a5d69390baf” but I get “77f13112951f458abf39d5e480c59eba10c97f31”, any idea why this might be the case? I’m not that experienced with this kinda stuff
My bad, it was being converted to lowercase before I printed the uploads:// link to the console, so decoding did not work. Using the correct casing does work!