anacrolix / confluence

Torrent client as a HTTP service
Mozilla Public License 2.0
237 stars 32 forks source link

Add filename parameter to GET /data #32

Closed boramalper closed 3 years ago

boramalper commented 3 years ago

IPFS gateways accepts filename query option to allow users to lazily "rename" the files upon access. This is not a must for a BitTorrent gateway since the filenames we deal with are not cryptographic hashes, though given the support for partial requests, there are cases where it makes sense to be able to rename the data (e.g. accessing subtitles in a ZIP container).

Signed-off-by: Bora M. Alper bora@boramalper.org

anacrolix commented 3 years ago

I've done this in the past on another project for the same reasons. I settled on using Content-Disposition: filename=+strconv.Quote(path.Base(...)). Inline and attachment added meaning that the browser would infer more correctly. I didn't get into the weeds with filename*, as this method worked the way I wanted for all the cases I tried.

boramalper commented 3 years ago

@anacrolix Changed as advised, let me know how it looks now.