Monorepo for Tangled tangled.org

Raw file links lose the file's name and path #4696

Open boltless.me
Open opened by boltless.me

Clicking View Raw on a file in a repo opens a URL like this:

https://tangled.org/thomas.rocks/wallpapers/raw/main/files/Cairn_Wallpaper_SnowForest_4k.jpg

which redirects to

https://api.tangled.org/xrpc/org.tangled.temp.git.getBlob?repo=did%3Aplc%3Acu46l66nbpoe6fqgfmawqqlk&ref=main&path=files%2FCairn_Wallpaper_SnowForest_4k.jpg

Because the URL path doesn't contain the filename, curl -O and wget save the file as org.tangled.temp.git.getBlob, and the link doesn't show which file it points to.

GitHub redirects raw links to a separate domain with the path in the URL, https://raw.githubusercontent.com/<owner>/<repo>/<ref>/<path>, so it works as a friendly preview and download link while still keeping repo content off the main domain (avoiding svg XSS attack)

This can be fixed from by either: A. serve /<repo-did>/<ref>/<path> link from knotmirror. We don't always have to use xrpc everywhere. B. host dedicated blob-serving service, internally calling knotmirror maybe, and be super clear about that it should NOT share origin from main web client domain.

Sign up or Sign in to add to the discussion.